Roblox/luau_corpus huggingface dataset:
-- << Functions >> --

UserInputService.MouseIconEnabled = false

function lerp(a, b, c)
	return a + (b - a) * c
end

bobbing = game:GetService("RunService").RenderStepped:Connect(function(deltaTime)
	if script.Parent.Humanoid.MoveDirection.Magnitude > 0 then
		deltaTime = deltaTime * (script.Parent.Humanoid.WalkSpeed * 3.75)	
	else
		deltaTime = deltaTime * 60
	end
	print(deltaTime)
	if Humanoid.Health <= 0 then
		bobbing:Disconnect()
		return
	end
	local rootMagnitude = Humanoid.RootPart and Vector3.new(Humanoid.RootPart.Velocity.X, 0, Humanoid.RootPart.Velocity.Z).Magnitude or 0
	local calcRootMagnitude = math.min(rootMagnitude, 50)
	if deltaTime > 3 then
		func1 = 0
		func2 = 0
	else
		func1 = lerp(func1, math.cos(tick() * 0.5 * math.random(10, 15)) * (math.random(5, 20) / 200) * deltaTime, 0.05 * deltaTime)
		func2 = lerp(func2, math.cos(tick() * 0.5 * math.random(5, 10)) * (math.random(2, 10) / 200) * deltaTime, 0.05 * deltaTime)
	end
	Camera.CFrame = Camera.CFrame * (CFrame.fromEulerAnglesXYZ(0, 0, math.rad(func3)) * CFrame.fromEulerAnglesXYZ(math.rad(func4 * deltaTime), math.rad(val * deltaTime), val2) * CFrame.Angles(0, 0, math.rad(func4 * deltaTime * (calcRootMagnitude / 5))) * CFrame.fromEulerAnglesXYZ(math.rad(func1), math.rad(func2), math.rad(func2 * 10)))
	val2 = math.clamp(lerp(val2, -Camera.CFrame:VectorToObjectSpace((Humanoid.RootPart and Humanoid.RootPart.Velocity or Vector3.new()) / math.max(Humanoid.WalkSpeed, 0.01)).X * 0.08, 0.1 * deltaTime), -0.35, 0.2)
	func3 = lerp(func3, math.clamp(UserInputService:GetMouseDelta().X, -5, 5), 0.25 * deltaTime)
	func4 = lerp(func4, math.sin(tick() * int) / 5 * math.min(1, int2 / 10), 0.25 * deltaTime)
	if rootMagnitude > 1 then
		val = lerp(val, math.cos(tick() * 0.5 * math.floor(int)) * (int / 200), 0.25 * deltaTime)
	else
		val = lerp(val, 0, 0.05 * deltaTime)
	end
	if rootMagnitude > 12 then
		int = 20
		int2 = 18
	elseif rootMagnitude > 0.1 then
		int = 12
		int2 = 14
	else
		int2 = 0
	end
	vect3 = lerp(vect3, Camera.CFrame.LookVector, 0.125 * deltaTime)
end)
-- / Game Assets / --

local GameAssets = game.ServerStorage.GameAssets

local Badges = GameAssets.Badges
--------RIGHT DOOR --------
game.Workspace.doorright.l11.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l23.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l32.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l53.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l62.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l71.BrickColor = BrickColor.new(1013)

game.Workspace.doorright.l12.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l21.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l33.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l42.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l51.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l63.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l72.BrickColor = BrickColor.new(1013)

game.Workspace.doorright.l13.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l22.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l31.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l43.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l52.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l61.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l73.BrickColor = BrickColor.new(1013)

game.Workspace.doorright.pillar.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
-- Define the jump duration
local jumpDuration = 0.1

btn.MouseButton1Click:Connect(function()
			-- Create the jump tween
			local Click = script.Click
			local jumpTweenInfo = TweenInfo.new(jumpDuration, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
	local jumpTween = game:GetService("TweenService"):Create(btn, jumpTweenInfo, {
		Size = UDim2.new(btn.Size.X.Scale * jumpScale, btn.Size.X.Offset,
			btn.Size.Y.Scale * jumpScale, btn.Size.Y.Offset),
		Position = UDim2.new(btn.Position.X.Scale - ((jumpScale - 1) / 2),
			btn.Position.X.Offset, btn.Position.Y.Scale - ((jumpScale - 1) / 2),
			btn.Position.Y.Offset)
			})

			-- Play the jump tween
			jumpTween:Play()
			Click:Play()

			-- Reset the button's size and position after the jump is complete
			jumpTween.Completed:Connect(function()
		btn.Size = UDim2.new(btn.Size.X.Scale / jumpScale, btn.Size.X.Offset,
			btn.Size.Y.Scale / jumpScale, btn.Size.Y.Offset)
		btn.Position = UDim2.new(btn.Position.X.Scale + ((jumpScale - 1) / 2),
			btn.Position.X.Offset, btn.Position.Y.Scale + ((jumpScale - 1) / 2),
			btn.Position.Y.Offset)
			end)
end)
-- Decompiled with the Synapse X Luau decompiler.

local l__HDAdminMain__1 = _G.HDAdminMain;
local l__playerGui__2 = l__HDAdminMain__1.playerGui;
local v3 = require(l__HDAdminMain__1.replicatedStorage:WaitForChild("HDAdmin"):WaitForChild("Topbar+").IconController);
local v4 = v3:createIcon("HDAdmin", 4882428756, 0);
v4:setToggleMenu(l__HDAdminMain__1.gui.MainFrame);
v4:notify();
return v3;
-- public static functions

function region3.new(cf, size)
	local self = {};
	self.CFrame = cf;
	self.Size = size;
	self.input = {vertices.block(cf, size * 0.5, {})};
	self.support = support.pointCloud;
	self.centroid = cf.p;
	return setmetatable(self, region3_mt);
end;

region3.block = region3.new;

function region3.wedge(cf, size)
	local self = {};
	self.CFrame = cf;
	self.Size = size;
	self.input = {vertices.wedge(cf, size * 0.5, {})};
	self.support = support.pointCloud;
	self.centroid = centroid(self.input[1]);
	return setmetatable(self, region3_mt);
end;

function region3.cornerWedge(cf, size)
	local self = {};
	self.CFrame = cf;
	self.Size = size;
	self.input = {vertices.cornerWedge(cf, size * 0.5, {})};
	self.support = support.pointCloud;
	self.centroid = centroid(self.input[1]);
	return setmetatable(self, region3_mt);
end;

function region3.cylinder(cf, size)
	local self = {};
	self.CFrame = cf;
	self.Size = size;
	self.input = {cf, size * 0.5};
	self.support = support.cylinder;
	self.centroid = cf.p;
	return setmetatable(self, region3_mt);
end;

function region3.ellipsoid(cf, size)
	local self = {};
	self.CFrame = cf;
	self.Size = size;
	self.input = {cf, size * 0.5};
	self.support = support.ellipsoid;
	self.centroid = cf.p;
	return setmetatable(self, region3_mt);
end;

function region3.pointCloud(cloud)
	local self = {};
	self.CFrame = CFrame.new(centroid(cloud));
	self.Size = v3();
	self.input = cloud;
	self.support = support.pointCloud;
	self.centroid = self.CFrame.p;
	return setmetatable(self, region3_mt);
end;

function region3.fromPart(part)
	return classify(part);
end;
-- ROBLOX: use patched console from shared
local console = require(script.Parent.console)

local loggedTypeFailures = {}

local ReactComponentStackFrame = require(script.Parent.ReactComponentStackFrame)
local describeUnknownElementTypeFrameInDEV =
	ReactComponentStackFrame.describeUnknownElementTypeFrameInDEV

local ReactSharedInternals = require(script.Parent.ReactSharedInternals)

local describeError = require(script.Parent["ErrorHandling.roblox"]).describeError

local ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame
--// F key, Horn
mouse.KeyDown:connect(function(key)
	if key=="h" then 
		veh.ELS.Sirens.MAN.Transparency = 0
		veh.ELS.Siren.Man:Play()
		veh.ELS.Siren2.Man:Play()
		veh.ELS.Sirens.Horn.Transparency = 0
		veh.ELS.Siren.Wail.Volume = 0
		veh.ELS.Siren.Yelp.Volume = 0
		veh.ELS.Siren.Priority.Volume = 0	
		veh.ELS.Siren2.Wail.Volume = 0
		veh.ELS.Siren2.Yelp.Volume = 0
		veh.ELS.Siren2.Priority.Volume = 0
	end
end)
-- Menus
local menuContainer = Instance.new("Frame")
menuContainer.Name = "MenuContainer"
menuContainer.BackgroundTransparency = 1
menuContainer.BorderSizePixel = 0
menuContainer.AnchorPoint = Vector2.new(1, 0)
menuContainer.Size = UDim2.new(0, 500, 0, 50)
menuContainer.ZIndex = -2
menuContainer.ClipsDescendants = true
menuContainer.Visible = true
menuContainer.Parent = iconContainer
menuContainer.Active = false
menuContainer.Selectable = false

local menuFrame = Instance.new("ScrollingFrame")
menuFrame.Name = "MenuFrame"
menuFrame.BackgroundTransparency = 1
menuFrame.BorderSizePixel = 0
menuFrame.AnchorPoint = Vector2.new(0, 0)
menuFrame.Position = UDim2.new(0, 0, 0, 0)
menuFrame.Size = UDim2.new(1, 0, 1, 0)
menuFrame.ZIndex = -1 + 10
menuFrame.ClipsDescendants = false
menuFrame.Visible = true
menuFrame.TopImage = ""--menuFrame.MidImage
menuFrame.BottomImage = ""--menuFrame.MidImage
menuFrame.HorizontalScrollBarInset = Enum.ScrollBarInset.Always
menuFrame.CanvasSize = UDim2.new(0, 0, 0, 0)
menuFrame.Parent = menuContainer
menuFrame.Active = false
menuFrame.Selectable = false
menuFrame.ScrollingEnabled = false

local menuList = Instance.new("UIListLayout")
menuList.Name = "MenuList"
menuList.FillDirection = Enum.FillDirection.Horizontal
menuList.HorizontalAlignment = Enum.HorizontalAlignment.Right
menuList.SortOrder = Enum.SortOrder.LayoutOrder
menuList.Parent = menuFrame

local menuInvisBlocker = Instance.new("Frame")
menuInvisBlocker.Name = "MenuInvisBlocker"
menuInvisBlocker.BackgroundTransparency = 1
menuInvisBlocker.Size = UDim2.new(0, -2, 1, 0)
menuInvisBlocker.Visible = true
menuInvisBlocker.LayoutOrder = 999999999
menuInvisBlocker.Parent = menuFrame
menuInvisBlocker.Active = false
--[[
	Visualizes the test plan in a simple format, suitable for debugging the test
	plan's structure.
]]
function TestPlan:visualize()
	local buffer = {}
	self:visitAllNodes(function(node, level)
		table.insert(buffer, (" "):rep(3 * level) .. node.phrase)
	end)
	return table.concat(buffer, "\n")
end
-- Left Arms
local LUA = character.UpperTorso:FindFirstChild("LeftShoulderRigAttachment")
local LUARig = character.LeftUpperArm:FindFirstChild("LeftShoulderRigAttachment")
local LLA = character.LeftUpperArm:FindFirstChild("LeftElbowRigAttachment")
local LLARig = character.LeftLowerArm:FindFirstChild("LeftElbowRigAttachment")
local LH = character.LeftLowerArm:FindFirstChild("LeftWristRigAttachment")
local LHRig = character.LeftHand:FindFirstChild("LeftWristRigAttachment")
------------------------------------------------

local function EnterFreecam()
	ToggleGui(false)
	UIS.MouseIconEnabled = false
	Maid:Mark(UIS.InputBegan:Connect(function(input, processed)
		if input.UserInputType == Enum.UserInputType.MouseButton2 then
			UIS.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
			local conn = UIS.InputChanged:Connect(Panned)
			repeat
				input = UIS.InputEnded:wait()
			until input.UserInputType == Enum.UserInputType.MouseButton2 or not freeCamEnabled
			panDeltaMouse = Vector2.new()
			panDeltaGamepad = Vector2.new()
			conn:Disconnect()
			if freeCamEnabled then
				UIS.MouseBehavior = Enum.MouseBehavior.Default
			end
		elseif input.KeyCode == Enum.KeyCode.LeftShift or input.KeyCode == Enum.KeyCode.RightShift then
			SpeedModifier = 0.5
		end
	end))

	Maid:Mark(UIS.InputEnded:Connect(function(input, processed)
		if input.KeyCode == Enum.KeyCode.LeftShift or input.KeyCode == Enum.KeyCode.RightShift then
			SpeedModifier = 1
		end
	end))

	camera.CameraType = Enum.CameraType.Scriptable

	local hum, hrp = GetChar()
	if hrp then
		hrp.Anchored = true
	end
	if hum then
		hum.WalkSpeed = 0
		Maid:Mark(hum.Jumping:Connect(function(active)
			if active then
				hum.Jumping = false
			end
		end))
	end

	velSpring.t, velSpring.v, velSpring.x = Vector3.new(), Vector3.new(), Vector3.new()
	rotSpring.t, rotSpring.v, rotSpring.x = Vector2.new(), Vector2.new(), Vector2.new()
	fovSpring.t, fovSpring.v, fovSpring.x = camera.FieldOfView, 0, camera.FieldOfView

	local camCFrame = camera.CFrame
	local lookVector = camCFrame.lookVector.unit

	stateRot = Vector2.new(
		math.asin(lookVector.y),
		math.atan2(-lookVector.z, lookVector.x) - math.pi/2
	)
	panDeltaMouse = Vector2.new()

	local playerGui = player:WaitForChild("PlayerGui")
	for _, obj in next, playerGui:GetChildren() do
		if obj:IsA("ScreenGui") and obj.Enabled then
			obj.Enabled = false
			screenGuis[obj] = true
		end
	end
	if letterBoxEnabled then
		letterbox.Enabled = true
	end
	RS:BindToRenderStep("Freecam", Enum.RenderPriority.Camera.Value, UpdateFreecam)
	freeCamEnabled = true
end

local function ExitFreecam()
	freeCamEnabled = false
	if letterBoxEnabled then
		letterbox.Enabled = false
	end
	UIS.MouseIconEnabled = true
	UIS.MouseBehavior = Enum.MouseBehavior.Default
	Maid:Sweep()
	RS:UnbindFromRenderStep("Freecam")
	local hum, hrp = GetChar()
	if hum then
		hum.WalkSpeed = 16
	end
	if hrp then
		hrp.Anchored = false
	end
	camera.FieldOfView = DEF_FOV
	camera.CameraType = Enum.CameraType.Custom
	for obj in next, screenGuis do
		obj.Enabled = true
	end
	screenGuis = {}
	ToggleGui(true)
end
--[[
	Gets the Context object for the current node.
]]
function TestSession:getContext()
	assert(#self.contextStack > 0, "Tried to get context from an empty stack!")
	return self.contextStack[#self.contextStack]
end
-- Decides when the GUI should be hidden.
-- 
-- ForbiddenJ

UserInputService = game:GetService("UserInputService")

IsDisplayed = script.Parent.IsDisplayed
IsHiddenByOtherGUI = script.Parent.IsHiddenByOtherGUI
HideGuiEnabled = game.ReplicatedStorage.ClientConfig.HideGuiEnabled
IsGameMenuOpen = script.Parent.Parent.GameMenu.IsOpen

MouseHovering = false

function Update()
	IsDisplayed.Value =
		(not HideGuiEnabled.Value or MouseHovering or UserInputService.TouchEnabled) and not IsHiddenByOtherGUI.Value
end

HideGuiEnabled.Changed:Connect(Update)
IsHiddenByOtherGUI.Changed:Connect(Update)
IsGameMenuOpen.Changed:Connect(function(value)
	IsHiddenByOtherGUI.Value = value
end)
UserInputService:GetPropertyChangedSignal("MouseEnabled"):Connect(Update)
script.Parent.MouseEnter:Connect(function()
	MouseHovering = true
	Update()
end)
script.Parent.MouseLeave:Connect(function()
	MouseHovering = false
	Update()
end)

IsHiddenByOtherGUI.Value = IsGameMenuOpen.Value
Update()
--[=[
	@class RemoteProperty
	@server
	Created via `ServerComm:CreateProperty()`.

	Values set can be anything that can pass through a
	[RemoteEvent](https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events#parameter-limitations).

	:::caution Network
	Calling any of the data setter methods (e.g. `Set()`) will
	fire the underlying RemoteEvent to replicate data to the
	clients. Therefore, setting data should only occur when it
	is necessary to change the data that the clients receive.
	:::

	:::caution Tables
	Tables _can_ be used with RemoteProperties. However, the
	RemoteProperty object will _not_ watch for changes within
	the table. Therefore, anytime changes are made to the table,
	the data must be set again using one of the setter methods.
	:::
]=]
local RemoteProperty = {}
RemoteProperty.__index = RemoteProperty

function RemoteProperty.new(parent: Instance, name: string, initialValue: any, inboundMiddleware: Types.ServerMiddleware?, outboundMiddleware: Types.ServerMiddleware?)
	local self = setmetatable({}, RemoteProperty)
	self._rs = RemoteSignal.new(parent, name, inboundMiddleware, outboundMiddleware)
	self._value = initialValue
	self._perPlayer = {}
	self._playerRemoving = Players.PlayerRemoving:Connect(function(player)
		self._perPlayer[player] = nil
	end)
	self._rs:Connect(function(player)
		local playerValue = self._perPlayer[player]
		local value = if playerValue == nil then self._value elseif playerValue == None then nil else playerValue
		self._rs:Fire(player, value)
	end)
	return self
end
-- FIXME Luau: GetPlayers() is typed as returning an array of Instances so we
-- need to cast it to `{ Player }`
local players = (Players:GetPlayers() :: any) :: { Player }
local controller = ExperienceComponents.HumanoidControllers.new(players, {
	Players.LocalPlayer :: Player,
})

Players.PlayerAdded:Connect(function(player)
	controller:addHumanoidController(player)
end)

Players.PlayerRemoving:Connect(function(player)
	controller:removeHumanoidController(player)
end)

local hideOthers: types.Action = {
	name = "Hide Others",
	description = "Toggle visibility of other players in your photo",
	icon = assets.UsersOutline,
	activeIcon = assets.UsersSolid,
	onActivated = function()
		controller:hideHumanoids()

		return function()
			controller:showHumanoids()
		end
	end,
}

return hideOthers
-- same as jump for now

function moveFreeFall()
	RightShoulder.MaxVelocity = 0.1
	LeftShoulder.MaxVelocity = 0.1
	RightShoulder:SetDesiredAngle(0)
	LeftShoulder:SetDesiredAngle(0)
	RightHip:SetDesiredAngle(0)
	LeftHip:SetDesiredAngle(0)
end

function moveSit()
	RightShoulder.MaxVelocity = 0.1
	LeftShoulder.MaxVelocity = 0.1
	RightShoulder:SetDesiredAngle(3.14 /2)
	LeftShoulder:SetDesiredAngle(-3.14 /2)
	RightHip:SetDesiredAngle(3.14 /2)
	LeftHip:SetDesiredAngle(-3.14 /2)
end

function getTool()	
	for _, kid in ipairs(Figure:GetChildren()) do
		if kid.className == "Tool" then return kid end
	end
	return nil
end

function getToolAnim(tool)
	for _, c in ipairs(tool:GetChildren()) do
		if c.Name == "toolanim" and c.className == "StringValue" then
			return c
		end
	end
	return nil
end

function animateTool()
	
	if (toolAnim == "None") then
		RightShoulder:SetDesiredAngle(1.57)
		return
	end

	if (toolAnim == "Slash") then
		RightShoulder.MaxVelocity = 0.5
		RightShoulder:SetDesiredAngle(0)
		return
	end

	if (toolAnim == "Lunge") then
		RightShoulder.MaxVelocity = 0.5
		LeftShoulder.MaxVelocity = 0.5
		RightShoulder:SetDesiredAngle(1.57)
		LeftShoulder:SetDesiredAngle(1.0)
		RightHip:SetDesiredAngle(1.57)
		LeftHip:SetDesiredAngle(1.0)
		return
	end
end

function move(time)
	local amplitude
	local frequency
  
	if (pose == "Jumping") then
		moveJump()
		return
	end

	if (pose == "FreeFall") then
		moveFreeFall()
		return
	end
 
	if (pose == "Seated") then
		moveSit()
		return
	end

	local climbFudge = 0
	
	if (pose == "Running") then
		RightShoulder.MaxVelocity = 0.1
		LeftShoulder.MaxVelocity = 0.1
		amplitude = 0.66
		frequency = 9
	elseif (pose == "Climbing") then
		RightShoulder.MaxVelocity = 0.1
		LeftShoulder.MaxVelocity = 0.1
		amplitude = 0.66
		frequency = 9
	else
		amplitude = 0.1
		frequency = 1
	end

	desiredAngle = amplitude * math.sin(time*frequency)

	RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
	LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
	RightHip:SetDesiredAngle(-desiredAngle)
	LeftHip:SetDesiredAngle(-desiredAngle)


	local tool = getTool()

	if tool then
	
		animStringValueObject = getToolAnim(tool)

		if animStringValueObject then
			toolAnim = animStringValueObject.Value
			-- message recieved, delete StringValue
			animStringValueObject.Parent = nil
			toolAnimTime = time + .3
		end

		if time > toolAnimTime then
			toolAnimTime = 0
			toolAnim = "None"
		end

		animateTool()

		
	else
		toolAnim = "None"
		toolAnimTime = 0
	end
end
-- Methods

function Sound.Get(Name : string) : Sound
	local s = Map[Name:lower()]
	if not s then warn(("No sound named '%s' found."):format(Name)) return EmptySound:Clone() end
	return s:Clone()
end

function Sound.GetGroup(Name : string) : {Sound}
	return Groups[Name:lower()]
end

function Sound.GetRandomFromGroup(Name : string, Rng : Random) : Sound
	Rng = Rng or System.Random
	local Group = Sound.GetGroup(Name)
	
	if not Group then warn(("No group named '%s' found."):format(Name)) return EmptySound:Clone() end
	return Group[Rng:NextInteger(1, #Group)]:Clone()
end
-- script makes the fall script active for ALL players! dont mess with this if your unexperienced.

function onPlayerRespawned(newPlayer)
	while true do
		if newPlayer.Character ~= nil then break end
		wait(.1)
	end
	local newJob = script.Fall:Clone()
	newJob.Disabled = false
	newJob.Parent = newPlayer.Character
end

function onPlayerEntered(newPlayer)
	newPlayer.Changed:connect(function (property)
		if (property == "Character") then
			onPlayerRespawned(newPlayer)
		end
	end)
end
c = game.Players:getChildren()
for i = 1, #c do
onPlayerEntered(c[i])
end
game.Players.PlayerAdded:connect(onPlayerEntered)
--[=[
	Returns a boolean determing if a ScriptSignal object is active.

	```lua
	ScriptSignal:IsActive() -> true
	ScriptSignal:Destroy()
	ScriptSignal:IsActive() -> false
	```

	@return boolean
	@ignore
]=]
function ScriptSignal:IsActive(): boolean
	return self._active == true
end
------------------------------------------------------------------------
-- parse part of an if control structure, including the condition
-- * used in ifstat()
------------------------------------------------------------------------
function luaY:test_then_block(ls)
  -- test_then_block -> [IF | ELSEIF] cond THEN block
  luaX:next(ls)  -- skip IF or ELSEIF
  local condexit = self:cond(ls)
  self:checknext(ls, "TK_THEN")
  self:block(ls)  -- `then' part
  return condexit
end
--- Creates a listable type from a singlular type
function Util.MakeListableType(type, override)
	local listableType = {
		Listable = true,
		Transform = type.Transform,
		Validate = type.Validate,
		ValidateOnce = type.ValidateOnce,
		Autocomplete = type.Autocomplete,
		Default = type.Default,
		Parse = function(...)
			return {type.Parse(...)}
		end
	}

	if override then
		for key, value in pairs(override) do
			listableType[key] = value
		end
	end

	return listableType
end

local function encodeCommandEscape(text)
	return (text:gsub("\\%$", "___!CMDR_DOLLAR!___"))
end

local function decodeCommandEscape(text)
	return (text:gsub("___!CMDR_DOLLAR!___", "$"))
end

function Util.RunCommandString(dispatcher, commandString)
	commandString = Util.ParseEscapeSequences(commandString)
	commandString = Util.EncodeEscapedOperators(commandString)

	local commands = commandString:split("&&")

	local output = ""
	for i, command in ipairs(commands) do
		local outputEncoded = output:gsub("%$", "\\x24")
		command = command:gsub("||", output:find("%s") and ("%q"):format(outputEncoded) or outputEncoded)

		output = tostring(
			dispatcher:EvaluateAndRun(
				(
					Util.RunEmbeddedCommands(dispatcher, command)
				)
			)
		)


		if i == #commands then
			return output
		end
	end
end
-- Light System.

LightSystem = script.Parent				-- Hello, Variables here
Lights = LightSystem.Lights
Switch = LightSystem.Button
Switch1 = Switch.Button1
Switch2 = Switch.Button2


on = false

children = Lights:GetChildren()

function onClicked()	
	if on == false then
		on = true
		Switch1.Transparency = 0
		Switch2.Transparency = 1
		for i = 1, #children do
			children[i].PointLight.Enabled = true
			print("Lights On")
		end
	elseif on == true then
		on = false
		Switch1.Transparency = 1
		Switch2.Transparency = 0
		for i = 1, #children do
			children[i].PointLight.Enabled = false
			print("Lights Off")
		end
	end
end

Switch.ClickDetector.MouseClick:connect(onClicked)
-- Variables (best not to touch these!)
local button = script.Parent .Parent.Parent
local car = script.Parent.Parent.Parent.Parent.Car.Value
local sound = script.Parent.Parent.Start
local st = script.Parent.Parent.Stall
st.Parent = car.DriveSeat
sound.Parent = car.DriveSeat -- What brick the start sound is playing from.
button.MouseButton1Click:connect(function() -- Event when the button is clicked
	if script.Parent.Parent.Parent.Text == "Engine: Off" then -- If the text says it's off then..
		sound:Play() -- Startup sound plays..
		wait(0.8) -- I don't know what to put for this
		script.Parent.Parent.Parent.Parent.IsOn.Value = true -- The car is is on, or in other words, start up the car.
		button.Text = "Engine: On"  -- You don't really need this, but I would keep it.
	else -- If it's on then when you click the button,
		st:play()
		script.Parent.Parent.Parent.Parent.IsOn.Value = false -- The car is turned off.
		button.Text = "Engine: Off"
	end -- Don't touch this.
end) -- And don't touch this either.