Roblox/luau_corpus huggingface dataset:
--Animation--
local RunAnimation = Instance.new('Animation')
RunAnimation.AnimationId = 'rbxassetid://'..ID
RAnimation = Humanoid:LoadAnimation(RunAnimation)
Running = false
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
AspirinaQuantidade.Text = Aspirina.Value
BandagemQuantidade.Text = Bandagem.Value
EnergeticoQuantidade.Text = Energetico.Value
EpinefrinaQuantidade.Text = Epinefrina.Value
MorfinaQuantidade.Text = Morfina.Value
SplintQuantidade.Text = Splint.Value
TourniquetQuantidade.Text = Tourniquet.Value

Aspirina.Changed:Connect(function()
	AspirinaQuantidade.Text = Aspirina.Value
end)

Bandagem.Changed:Connect(function()
	BandagemQuantidade.Text = Bandagem.Value
end)

Splint.Changed:Connect(function()
	SplintQuantidade.Text = Splint.Value
end)

Tourniquet.Changed:Connect(function()
	TourniquetQuantidade.Text = Tourniquet.Value
end)

Energetico.Changed:Connect(function()
	EnergeticoQuantidade.Text = Energetico.Value
end)

Epinefrina.Changed:Connect(function()
	EpinefrinaQuantidade.Text = Epinefrina.Value
end)

Morfina.Changed:Connect(function()
	MorfinaQuantidade.Text = Morfina.Value
end)

SacoDeSangue.Changed:Connect(function()
	SacoDeSangueQuantidade.Text = SacoDeSangue.Value
end)
--[[
	Increments the health by the specified amount, will also update markers and other visual showcases of the health amount.
]]
function BaseSystem:incrementHealth(amount)
	self._health = math.clamp(self._health + amount, 0, self._maxHealth)

	local percent = self._health / self._maxHealth

	if not self.noScreenUpdate then
		local aliveColor = Color3.fromRGB(110, 153, 202)
		local deadColor = Color3.fromRGB(200, 93, 96)

		local targetColor = deadColor:Lerp(aliveColor, percent)
		for _, child in pairs(self._model:FindFirstChild("Screen"):GetChildren()) do
			TweenService:Create(child, tweenInfo, {Color = targetColor}):Play()
		end
	end

	if self:canTurnOn() then
		self:turnOn()
	elseif self._health == 0 and self:isOn() then
		self:turnOff()
	end

	if amount < 0 and percent < 0.25 then
		sendAlert(Constants.Alert.Fail, self.repairAlert)
	elseif self._health == 0 then
		sendAlert(Constants.Alert.Fail, self.brokenAlert)
	end

	if self:isOn() then
		if percent < 0.2 then
			self:_setMarker(self.brokenMarker)
		elseif percent < 0.5 then
			self:_setMarker(self.repairMarker)
		else
			self:_setMarker()
		end
	end
end
--Make brush cursor follow mouse and put paint where the player clicks
game:GetService("RunService").Stepped:Connect(function()
	
	if canvas.Visible == true and cursor.Visible == true then
		
		local x = math.abs(mouse.X - canvas.AbsolutePosition.X)
		local y = math.abs(mouse.Y - canvas.AbsolutePosition.Y)
		
		cursor.Position = UDim2.new(x/canvas.AbsoluteSize.X, 0, y/canvas.AbsoluteSize.Y, 0)
		cursor.Size = UDim2.new(0, currentSize, 0, currentSize)
	
		if down then
				
			local paint = script.Paint:Clone()
				
			paint.Position = UDim2.new(x/canvas.AbsoluteSize.X, 0, y/canvas.AbsoluteSize.Y, 0)
			paint.Size = UDim2.new(0, currentSize, 0, currentSize)
				
			paint.ImageColor3 = erasing and Color3.fromRGB(185, 185, 185) or currentColor
				
			paint.Parent = paintContainer
		end
	end
end)
------------------------------------------------------------------------
-- create a chunk reader from a source string
------------------------------------------------------------------------
function luaZ:make_getS(buff)
  local b = buff
  return function() -- chunk reader anonymous function here
    if not b then return nil end
    local data = b
    b = nil
    return data
  end
end
-- Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerScriptService = game:GetService("ServerScriptService")
local Players = game:GetService("Players")
--[[
	PlayerScriptsLoader - This script requires and instantiates the PlayerModule singleton
	
	2018 PlayerScripts Update - AllYourBlox	
--]]
local PlayerModule = require(script.Parent:WaitForChild("PlayerModule"))
--Gamepad support
userInputService.InputChanged:connect(function(inputObject, gameProcessedEvent)
	--if not gameProcessedEvent then
		if inputObject.KeyCode == Enum.KeyCode.Thumbstick1 then
			if inputObject.Position.magnitude >= gamepadDeadzone then
				movement = Vector2.new(movement.X, inputObject.Position.Y)
			else
				movement = Vector2.new(movement.X, 0)
			end
		elseif inputObject.KeyCode == Enum.KeyCode.Thumbstick2 then
			if inputObject.Position.magnitude >= gamepadDeadzone then
				movement = Vector2.new(inputObject.Position.X, movement.Y)
			else
				movement = Vector2.new(0, movement.Y)
			end
		end
	--end
end)
-- REBIRTHS

x2RebirthsButton.MouseEnter:Connect(function()
	x2RebirthsButton.Text = "299 R$"
	x2RebirthsButton.TextColor3 = Color3.fromRGB(0, 255, 0)
end)

x2RebirthsButton.MouseLeave:Connect(function()
	x2RebirthsButton.Text = "BUY"
	x2RebirthsButton.TextColor3 = Color3.fromRGB(255, 255, 255)
end)
-- declarations

local jumpAnimTime = 0
local jumpAnimDuration = 0.3

local toolTransitionTime = 0.1
local fallTransitionTime = 0.3
local jumpMaxLimbVelocity = 0.75
--You can change the values below to suit your needs

local max_mode = 40 --The maximum amount of modes forwards. Set to 0 to disable forwards motion.

local min_mode = 0 --The minimum amount of modes backwards. Set to 0 to disable backwards motion.

local increment_speed = 0.1 --The amount in which the speed value increments with every mode.
-- ROBLOX deviation: returning a function to be able to re-execute the module in tests
return function()
	type unknown = any --[[ ROBLOX FIXME: adding `unknown` type alias to make it easier to use Luau unknown equivalent when supported ]]
	local CurrentModule = script.Parent
	local Packages = CurrentModule.Parent
	local LuauPolyfill = require(Packages.LuauPolyfill)
	local Array = LuauPolyfill.Array
	local Object = LuauPolyfill.Object
	local String = LuauPolyfill.String
	local Symbol = LuauPolyfill.Symbol

	local Promise = require(Packages.Promise)

	local exports = {}

	-- ROBLOX deviation: fs not necessary
	-- local fs = require(Packages["graceful-fs"])
	local typesModule = require(Packages.JestTypes)
	type Config_ConfigGlobals = typesModule.Config_ConfigGlobals
	local createProcessObject = require(script.Parent.createProcessObject).default
	local deepCyclicCopy = require(script.Parent.deepCyclicCopy).default

	local DTRACE = Array.filter(Object.keys(_G), function(key)
		return typeof(key) == "string" and String.startsWith(key, "DTRACE")
	end)

	exports.default =
		function(globalObject: typeof(_G), globals: Config_ConfigGlobals): typeof(_G) & Config_ConfigGlobals
			-- ROBLOX deviation: added self to be able to bind DTRACE functions
			local self = globalObject
			globalObject.process = createProcessObject()
			-- Keep a reference to some globals that Jest needs
			Object.assign(globalObject, {
				-- ROBLOX deviation START: not making props readonly
				-- ROBLOX FIXME: have to cast element to `any` to avoid type narrowing issue
				[Symbol.for_("jest-native-promise")] = Promise :: any,
				[Symbol.for_("jest-native-now")] = DateTime.now,
				-- ROBLOX deviation END
				-- ROBLOX deviation START: skipped fs related globals
				-- [Symbol.for_("jest-native-read-file")] = {
				-- 	enumerable = false,
				-- 	value = fs.readFileSync:bind(fs),
				-- 	writable = false,
				-- },
				-- [Symbol.for_("jest-native-write-file")] = {
				-- 	enumerable = false,
				-- 	value = fs.writeFileSync:bind(fs),
				-- 	writable = false,
				-- },
				-- [Symbol.for_("jest-native-exists-file")] = {
				-- 	enumerable = false,
				-- 	value = fs.existsSync:bind(fs),
				-- 	writable = false,
				-- },
				-- ROBLOX deviation END
				-- ROBLOX deviation START: not making props readonly
				["jest-symbol-do-not-touch"] = Symbol,
				-- ROBLOX deviation END
			})

			-- Forward some APIs.
			Array.forEach(DTRACE, function(dtrace)
				-- @ts-expect-error: no index
				globalObject[dtrace] = function(_self, ...: any)
					local args = { ... }
					-- @ts-expect-error: no index
					return _G[dtrace](self, table.unpack(args))
				end
			end)
			return Object.assign(globalObject, deepCyclicCopy(globals))
		end
	return exports
end
--[=[
	@within TableUtil
	@function Flat
	@param tbl table
	@param depth number?
	@return table

	Returns a new table where all sub-arrays have been
	bubbled up to the top. The depth at which the scan
	is performed is dictated by the `depth` parameter,
	which is set to `1` by default.

	```lua
	local t = {{10, 20}, {90, 100}, {30, 15}}
	local flat = TableUtil.Flat(t)
	print(flat) --> {10, 20, 90, 100, 30, 15}
	```

	:::note Arrays only
	This function works on arrays, but not dictionaries.
]=]
local function Flat(tbl: Table, depth: number?): Table
	local maxDepth: number = if type(depth) == "number" then depth else 1
	local flatTbl = table.create(#tbl)
	local function Scan(t: Table, d: number)
		for _,v in ipairs(t) do
			if type(v) == "table" and d < maxDepth then
				Scan(v, d + 1)
			else
				table.insert(flatTbl, v)
			end
		end
	end
	Scan(tbl, 0)
	return flatTbl
end
-- See if I have a tool
local spawner = script.Parent
local tool = nil
local region = Region3.new(Vector3.new(spawner.Position.X - spawner.Size.X/2, spawner.Position.Y + spawner.Size.Y/2, spawner.Position.Z - spawner.Size.Z/2),
   Vector3.new(spawner.Position.X + spawner.Size.X/2, spawner.Position.Y + 4, spawner.Position.Z + spawner.Size.Z/2))
local parts = game.Workspace:FindPartsInRegion3(region)
for _, part in pairs(parts) do
	if part and part.Parent and part.Parent:IsA("Tool") then
		tool = part.Parent
		break
	end
end

local configTable = spawner.Configurations
local configs = {}
local function loadConfig(configName, defaultValue)
	if configTable:FindFirstChild(configName) then
		configs[configName] = configTable:FindFirstChild(configName).Value
	else
		configs[configName] = defaultValue
	end
end

loadConfig("SpawnCooldown", 5)

if tool then
	tool.Parent = game.ServerStorage
	
	while true do
		-- put tool on pad
		local toolCopy = tool:Clone()
		local handle = toolCopy:FindFirstChild("Handle")
		toolCopy.Parent = game.Workspace
		local toolOnPad = true
		local parentConnection
		parentConnection = toolCopy.AncestryChanged:connect(function()
			if handle then handle.Anchored = false end
			toolOnPad = false
			parentConnection:disconnect()
		end)
		if handle then
			handle.CFrame = (spawner.CFrame + Vector3.new(0,handle.Size.Z/2 + 1,0)) * CFrame.Angles(-math.pi/2,0,0)
			handle.Anchored = true
		end
		-- wait for tool to be removed
		while toolOnPad do 
			if handle then
				handle.CFrame = handle.CFrame * CFrame.Angles(0,0,math.pi/60)
			end
			wait() 
		end
		
		-- wait for cooldown
		wait(configs["SpawnCooldown"])		
	end
	
end
-- Overrides the current weather with a new one. this is purley the visual side.
WeatherPrompt.OnClientEvent:Connect(function(WeatherInfo)
	
		
		
	
	local Skip = coroutine.wrap(function()
		

		local tweenInfo = TweenInfo.new(
			10, -- Time
			Enum.EasingStyle.Linear, -- EasingStyle
			Enum.EasingDirection.Out -- EasingDirection
		)

		local tween = TweenService:Create(game.Lighting, tweenInfo, WeatherInfo["LightingSettings"])
				
		tween:Play()
	end)

	Skip()
	
end)
-- Compiled with roblox-ts v2.1.0
local TS = require(game:GetService("ReplicatedStorage"):WaitForChild("rbxts_include"):WaitForChild("RuntimeLib"))
local Log = TS.import(script, game:GetService("ReplicatedStorage"), "rbxts_include", "node_modules", "@rbxts", "log", "out").default
local _components = TS.import(script, game:GetService("ReplicatedStorage"), "TS", "components")
local Body = _components.Body
local NPC = _components.NPC
local Wants = _components.Wants
local function customer(world, _)
	for id, wants in world:queryChanged(Wants) do
		if not wants.old and wants.new then
			Log.Info("v Wants " .. (tostring(id) .. (" | " .. (tostring(wants.new.product.amount) .. ("x " .. wants.new.product.product)))))
			task.delay(1, function()
				if not world:contains(id) then
					return nil
				end
				local npc = world:get(id, NPC)
				local _result = world:get(id, Body)
				if _result ~= nil then
					_result = _result.model
				end
				local body = _result
				if not npc or not body then
					Log.Error("No NPC or Body component for customer")
					return nil
				end
				body.DialogGui.DialogFrame.DialogText.Text = "I want " .. (tostring(wants.new.product.amount) .. ("x " .. wants.new.product.product))
				body.DialogGui.Enabled = true
			end)
		end
		if wants.old and wants.new then
			Log.Info("x Wants " .. (tostring(id) .. (" | " .. (tostring(wants.new.product.amount) .. ("x " .. wants.new.product.product)))))
			if not world:contains(id) then
				return nil
			end
			local npc = world:get(id, NPC)
			local _result = world:get(id, Body)
			if _result ~= nil then
				_result = _result.model
			end
			local body = _result
			if not npc or not body then
				Log.Error("No NPC or Body component for customer")
				continue
			end
			body.DialogGui.DialogFrame.DialogText.Text = "I want " .. (tostring(wants.new.product.amount) .. ("x " .. wants.new.product.product))
			body.DialogGui.Enabled = true
		end
		if wants.old and not wants.new then
			if not world:contains(id) then
				return nil
			end
			local npc = world:get(id, NPC)
			local _result = world:get(id, Body)
			if _result ~= nil then
				_result = _result.model
			end
			local body = _result
			if not npc or not body then
				Log.Error("No NPC or Body component for customer")
				continue
			end
			body.DialogGui.DialogFrame.DialogText.Text = "Thanks!"
			task.wait(2)
			body.DialogGui.Enabled = false
		end
	end
end
return customer
--[[
	A middleware that allows for functions to be dispatched.
	Functions will receive a single argument, the store itself.
	This middleware consumes the function; middleware further down the chain
	will not receive it.
]]
local function tracebackReporter(message)
	return debug.traceback(message)
end

local function thunkMiddleware(nextDispatch, store)
	return function(action)
		if typeof(action) == "function" then
			local ok, result = xpcall(function()
				return action(store)
			end, tracebackReporter)

			if not ok then
				-- report the error and move on so it's non-fatal app
				store._errorReporter.reportReducerError(store:getState(), action, {
					message = "Caught error in thunk",
					thrownValue = result,
				})
				return nil
			end

			return result
		end

		return nextDispatch(action)
	end
end

return thunkMiddleware
--[[
Make sure to put Menu Blur Script in StarterGui
And that you put MenuBlur in Lighting

Or paste this in the command bar:
	workspace:WaitForChild("Menu Blur Script").MenuBlur.Parent = game:GetService("Lighting") wait() workspace:WaitForChild("Menu Blur Script").Parent = game:GetService("StarterGui")
]]		




local Lighting = game:GetService("Lighting")

local MenuBluriness = Lighting.MenuBlur



local GuiService = game:GetService("GuiService")
GuiService.MenuOpened:Connect(function()
	MenuBluriness.Enabled = true
end)
 
GuiService.MenuClosed:Connect(function()
	MenuBluriness.Enabled = false
end)
--[[ @brief Removes and returns the smallest element on the heap.
     @return The smallest element on the heap (using the stored comparator function).
--]]
function Heap:Pop()
	local v = self[1];
	self[1] = self[#self];
	self[#self] = nil;
	self:_HeapifyTopDown(1);
	return v;
end
-- Color Changing Script ~ Rainbow!
while true do
script.Parent.BrickColor = BrickColor.Red()
wait(1)
script.Parent.Color = Color3.fromRGB(255, 149, 0)
wait(1)
script.Parent.BrickColor = BrickColor.Yellow()
wait(1)
script.Parent.BrickColor = BrickColor.Green()
wait(1)
script.Parent.Color = Color3.fromRGB(0, 255, 255)
wait(1)
script.Parent.BrickColor = BrickColor.Blue()
wait(1)
script.Parent.Color = Color3.fromRGB(226, 0, 255)
wait(1)
end
-- Class

local CheckboxLabelClass = {}
CheckboxLabelClass.__index = CheckboxLabelClass
CheckboxLabelClass.__type = "CheckboxLabel"

function CheckboxLabelClass:__tostring()
	return CheckboxLabelClass.__type
end
-- Events
local events = ReplicatedStorage.Events
local roundEnd = events.RoundEnd
local displayRoundResult = events.DisplayRoundResult
--Initialize
--* called by the client immediately after it is initialized.
--* used to pass communication functions into the interface.
--* the current list of functions is as follows:
--********************************************************--
--*--UserEnded
--*--* Call this function when the user manually ends
--*--* any dialogue, so that the server can respond
--*--* accordingly and not send false timeout signals
--********************************************************--
function Interface.Initialize(clientFunctions)
	Interface.ClientFunctions = clientFunctions
end
--Reset Colour
	script.Parent.Configuration.Colour.Value = Color3.new(255, 255, 255)
	--ResetScript Ends
script.Parent.Configuration.Reset.Value = false;
end

end)
--
local Class = require(script.Class)
local Equipment = require(script.Equipment)

local LoadoutStates = require(game.ReplicatedStorage.Shared.LoadoutStates)


local Menu = New "Frame" {
	Size = UDim2.fromScale(1, 1),
	Transparency = 1,
	Visible = Computed(function()
		return LoadoutStates.Visible:get()
	end),
	[Children] = {
		New "UIAspectRatioConstraint" {
			AspectRatio = 1920/1080
		},
		Class {},
		Equipment {},
	},
}

return Menu
--brake.Value = TCount
else
brake.Value = 1
end

if carSeat.Throttle == -1 and speed < 50 then
	script.FL.OVERRIDE.Value = true
	script.FR.OVERRIDE.Value = true
	script.RL.OVERRIDE.Value = true
	script.RR.OVERRIDE.Value = true
else
	script.FL.OVERRIDE.Value = false
	script.FR.OVERRIDE.Value = false
	script.RL.OVERRIDE.Value = false
	script.RR.OVERRIDE.Value = false
end
-- Decompiled with the Synapse X Luau decompiler.

for v1, v2 in ipairs(script.Parent:GetChildren()) do
	if v2:IsA("ImageButton") then
		v2.MouseEnter:Connect(function()
			v2.Rotation = 5;
		end);
		v2.MouseLeave:Connect(function()
			v2.Rotation = 0;
		end);
	end;
end;
-- Decompiled with Visenya | https://targaryentech.com
local MiscWeld = {}
function MakeWeld(x, y, type, s)
  if type == nil then
    type = "Weld"
  end
  local W = Instance.new(type)
  W.Part0 = x
  W.Part1 = y
  W.C0 = x.CFrame:inverse() * x.CFrame
  W.C1 = y.CFrame:inverse() * x.CFrame
  W.Parent = x
  if type == "Motor" and s ~= nil then
    W.MaxVelocity = s
  end
  return W
end
function ModelWeld(a, b)
  if a:IsA("BasePart") then
    MakeWeld(b, a, "Weld")
  elseif a:IsA("Model") then
    for i, v in pairs(a:GetDescendants()) do
      ModelWeld(v, b)
    end
  end
end
car = script.Parent.Parent.Parent
misc = car:WaitForChild("Misc")
car.DriveSeat.ChildAdded:connect(function(child)
  if child.Name == "SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent) ~= nil then
    child.C0 = CFrame.new(0, -0.5, 0) * CFrame.fromEulerAnglesXYZ(-(math.pi / 2), 0, 0)
  end
end)
return MiscWeld
-- Compiled with roblox-ts v2.1.0
local TS = require(game:GetService("ReplicatedStorage"):WaitForChild("rbxts_include"):WaitForChild("RuntimeLib"))
local Players = TS.import(script, game:GetService("ReplicatedStorage"), "rbxts_include", "node_modules", "@rbxts", "services").Players
local Client = TS.import(script, game:GetService("ReplicatedStorage"), "TS", "components").Client
local player = Players.LocalPlayer
local function client(world, state)
	for id, client in world:queryChanged(Client) do
		if not client.old and (client.new and client.new.player.UserId == player.UserId) then
			state.playerId = id
			return nil
		end
	end
end
return client
----- cold tap handler -----

coldTap.Interactive.ClickDetector.MouseClick:Connect(function()
	if coldOn.Value == false then
		coldOn.Value = true
		faucet.ParticleEmitter.Enabled = true
		waterSound:Play()
		hotTap.Interactive.ClickDetector.MaxActivationDistance = 0
		coldTap.Interactive.ClickDetector.MaxActivationDistance = 32
		hotTap.Handle.Transparency = 1
		coldTap.Handle.Transparency = 0
		handle.HandleOff.Transparency = 1
	else
		coldOn.Value = false
		if hotOn.Value == false then
			faucet.ParticleEmitter.Enabled = false
			waterSound:Stop()
		end
		hotTap.Interactive.ClickDetector.MaxActivationDistance = 32
		coldTap.Interactive.ClickDetector.MaxActivationDistance = 32
		hotTap.Handle.Transparency = 1
		coldTap.Handle.Transparency = 1
		handle.HandleOff.Transparency = 0
	end
end)
--[[
	Add a dummy child node to the current node to hold the given error. This
	allows an otherwise empty describe node to report an error in a more natural
	way.
]]
function TestSession:addDummyError(phrase, message)
	self:pushNode({ type = TestEnum.NodeType.It, phrase = phrase })
	self:setError(message)
	self:popNode()
	self.nodeStack[#self.nodeStack].status = TestEnum.TestStatus.Failure
end
--[[Driver Handling]]

	--Driver Sit	
	car.DriveSeat.ChildAdded:connect(function(child)
		if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
			--Distribute Client Interface
			local p=game.Players:GetPlayerFromCharacter(child.Part1.Parent)
			car.DriveSeat:SetNetworkOwner(p)
			local g=script.Parent["A-Chassis Interface"]:Clone()
			g.Parent=p.PlayerGui
			script.Parent.Parent.Body.Raycaster.Script.Values.Value = g
		end
	end)
	
	--Driver Leave
	car.DriveSeat.ChildRemoved:connect(function(child)
		if child.Name=="SeatWeld" and child:IsA("Weld") then
			--Remove Flip Force
			if car.DriveSeat:FindFirstChild("Flip")~=nil then
				car.DriveSeat.Flip.MaxTorque = Vector3.new()
			end
			
			--Remove Wheel Force
			for i,v in pairs(car.Wheels:GetChildren()) do
				if v:FindFirstChild("#AV")~=nil then
					if v["#AV"]:IsA("BodyAngularVelocity") then
						if v["#AV"].AngularVelocity.Magnitude>0 then
							v["#AV"].AngularVelocity = Vector3.new()
							v["#AV"].MaxTorque = Vector3.new()
						end
					else
						if v["#AV"].AngularVelocity>0 then
							v["#AV"].AngularVelocity = 0
							v["#AV"].MotorMaxTorque = 0
						end
					end
				end
			end
		end
	end)
-- ScriptSignal object:

local ScriptSignal = {
	--[[
		_head = nil,
		_listener_count = 0,
	--]]
}
ScriptSignal.__index = ScriptSignal

function ScriptSignal:Connect(listener, disconnect_listener, disconnect_param) --> [ScriptConnection]

	local script_connection = {
		_listener = listener,
		_script_signal = self,
		_disconnect_listener = disconnect_listener,
		_disconnect_param = disconnect_param,

		_next = self._head,
		_is_connected = true,
	}
	setmetatable(script_connection, ScriptConnection)

	self._head = script_connection
	self._listener_count += 1

	return script_connection

end

function ScriptSignal:GetListenerCount() --> [number]
	return self._listener_count
end

function ScriptSignal:Fire(...)
	local item = self._head
	while item ~= nil do
		if item._is_connected == true then
			if not FreeRunnerThread then
				FreeRunnerThread = coroutine.create(RunEventHandlerInFreeThread)
			end
			task.spawn(FreeRunnerThread, item._listener, ...)
		end
		item = item._next
	end
end

function ScriptSignal:FireUntil(continue_callback, ...)
	local item = self._head
	while item ~= nil do
		if item._is_connected == true then
			item._listener(...)
			if continue_callback() ~= true then
				return
			end
		end
		item = item._next
	end
end

function MadworkScriptSignal.NewScriptSignal() --> [ScriptSignal]
	return {
		_head = nil,
		_listener_count = 0,
		Connect = ScriptSignal.Connect,
		GetListenerCount = ScriptSignal.GetListenerCount,
		Fire = ScriptSignal.Fire,
		FireUntil = ScriptSignal.FireUntil,
	}
end

return MadworkScriptSignal