Pinkstack/roblox-luau-corpus-text huggingface dataset:
--[[
	
	DEVELOPMENT HAS BEEN MOVED FROM DAVEY_BONES/SCELERATIS TO THE EPIX INCORPORATED GROUP
	
	CURRENT LOADER:
	https://www.roblox.com/library/7510622625/Adonis-Loader-Sceleratis-Davey-Bones-Epix
	
	CURRENT MODULE:
	https://www.roblox.com/library/7510592873/Adonis-MainModule

--]]
--[[
	Fired when Finished is entered, throwing out a player state update, as well as transitioning the player state
]]


function Transitions.onEnterFinished(stateMachine, event, from, to, playerComponent)
	Logger.trace(playerComponent.player.Name, " state change: ", from, " -> ", to)
	playerComponent:updateStatus("currentState", to)
	PlayerFinished.enter(stateMachine, playerComponent)
end
-----------------------------------


elseif script.Parent.Parent.Parent.TrafficControl.Value == "=" then

	script.Parent.Parent.A.BrickColor = BrickColor.new("Medium stone grey") 
	
	script.Parent.Parent.B.BrickColor = BrickColor.new("Medium stone grey") 
	
	script.Parent.Parent.C.BrickColor = BrickColor.new("Medium stone grey") 
	
	script.Parent.Parent.D.BrickColor = BrickColor.new("New Yeller") 
	
	script.Parent.Parent.E.BrickColor = BrickColor.new("Medium stone grey") 
	
	script.Parent.Parent.F.BrickColor = BrickColor.new("Medium stone grey") 

	script.Parent.Parent.G.BrickColor = BrickColor.new("Medium stone grey")


	
	wait(0.3)

	script.Parent.Parent.A.BrickColor = BrickColor.new("Medium stone grey") 
	
	script.Parent.Parent.B.BrickColor = BrickColor.new("Medium stone grey") 
	
	script.Parent.Parent.C.BrickColor = BrickColor.new("New Yeller") 
	
	script.Parent.Parent.D.BrickColor = BrickColor.new("New Yeller") 
	
	script.Parent.Parent.E.BrickColor = BrickColor.new("New Yeller") 
	
	script.Parent.Parent.F.BrickColor = BrickColor.new("Medium stone grey") 

	script.Parent.Parent.G.BrickColor = BrickColor.new("Medium stone grey")


	wait(0.35) 

	script.Parent.Parent.A.BrickColor = BrickColor.new("Medium stone grey") 
	
	script.Parent.Parent.B.BrickColor = BrickColor.new("New Yeller") 
	
	script.Parent.Parent.C.BrickColor = BrickColor.new("New Yeller") 
	
	script.Parent.Parent.D.BrickColor = BrickColor.new("New Yeller") 
	
	script.Parent.Parent.E.BrickColor = BrickColor.new("New Yeller") 
	
	script.Parent.Parent.F.BrickColor = BrickColor.new("New Yeller") 

	script.Parent.Parent.G.BrickColor = BrickColor.new("Medium stone grey")

	
	
	wait(0.35) 

	script.Parent.Parent.A.BrickColor = BrickColor.new("New Yeller") 
	
	script.Parent.Parent.B.BrickColor = BrickColor.new("New Yeller") 
	
	script.Parent.Parent.C.BrickColor = BrickColor.new("New Yeller") 
	
	script.Parent.Parent.D.BrickColor = BrickColor.new("New Yeller") 
	
	script.Parent.Parent.E.BrickColor = BrickColor.new("New Yeller") 
	
	script.Parent.Parent.F.BrickColor = BrickColor.new("New Yeller") 

	script.Parent.Parent.G.BrickColor = BrickColor.new("New Yeller")

	
	wait(0.35) 

	script.Parent.Parent.A.BrickColor = BrickColor.new("Medium stone grey") 
	
	script.Parent.Parent.B.BrickColor = BrickColor.new("Medium stone grey") 
	
	script.Parent.Parent.C.BrickColor = BrickColor.new("Medium stone grey") 
	
	script.Parent.Parent.D.BrickColor = BrickColor.new("Medium stone grey") 
	
	script.Parent.Parent.E.BrickColor = BrickColor.new("Medium stone grey") 
	
	script.Parent.Parent.F.BrickColor = BrickColor.new("Medium stone grey") 

	script.Parent.Parent.G.BrickColor = BrickColor.new("Medium stone grey")

	
	wait(0.35) 

end
end
--[[
	Constructs a new ForKeys state object which maps keys of an array using
	a `processor` function.

	Optionally, a `destructor` function can be specified for cleaning up
	calculated keys. If omitted, the default cleanup function will be used instead.

	Optionally, a `meta` value can be returned in the processor function as the
	second value to pass data from the processor to the destructor.
]]



local Dependencies = require(script.Parent.Parent.Dependencies)
local utility = Dependencies.utility

local class = {}

local CLASS_METATABLE = { __index = class }
-- << VARIABLES >>


local humanoidDescriptions = {}
local accessoryTypes = {
	[8] = "HatAccessory",
    [41] = "HairAccessory",
    [42] = "FaceAccessory",
    [43] = "NeckAccessory",
    [44] = "ShouldersAccessory",
    [45] = "FrontAccessory",
    [46] = "BackAccessory",
    [47] = "WaistAccessory",
}
local correspondingBodyParts = {
	["Torso"]		= {"UpperTorso","LowerTorso"};
	["Left Arm"] 	= {"LeftHand","LeftLowerArm","LeftUpperArm"};
	["Right Arm"]	= {"RightHand","RightLowerArm","RightUpperArm"};
	["Left Leg"]	= {"LeftFoot","LeftLowerLeg","LeftUpperLeg"};
	["Right Leg"]	= {"RightFoot","RightLowerLeg","RightUpperLeg"};
	}
-- Editable Values


local TurboId = 240323039
local SuperId = 404779487
local BovId = 3568930062

local TurboVol = .025				--Per Psi
local TurboRollOffMax = 1000
local TurboRollOffMin = 10

local SuperVol = .025				--Per Psi
local SuperRollOffMax = 1000
local SuperRollOffMin = 10

local BovVol = .025				--Per Psi
local BovRollOffMax = 1000
local BovRollOffMin = 10
local BovSensitivity = .5

local TurboSetPitch = 1		--Base Pitch
local SuperSetPitch = .8	--Base Pitch
local BovSetPitch = .7		--Base Pitch
local TurboPitchIncrease = .05	--Per Psi
local SuperPitchIncrease = .05	--Per Psi
local BovPitchIncrease = .05	--Per Psi

local FE=true
--if false then
--	local i, v = 1, 2
--	local Item = Items[i]
--	local NewItem = script.Parent.Gear.ItemsScrollingFrame.ItemTemplate1:Clone()
--	NewItem.Parent = script.Parent.Gear.ItemsScrollingFrame
--	NewItem.Visible = true
--	NewItem.Name = v.Name
--	NewItem.Price.Text = v.Price
--	NewItem.Icon.Image = v.Decal
--	NewItem.ItemName.Text = v.Name
--	NewItem.Buy.MouseButton1Click:Connect(function()
--		local f = script.Parent.Gear.Item
--		f.ItemName.Text = NewItem.Name
--		f.ItemImage.Image = v.Decal
--		f.Description.Text = v.Special
--		f.Add.MouseButton1Click:Connect(function()
--			table.insert(Cart,Item)
--		end)
--	end)
--end
-- connect to RenderStepped (update every frame)


RunService.RenderStepped:Connect(function()
 
	-- make sure the character exists
	local character = localPlayer.Character
	if not character then
		-- disable the beam
		beam.Enabled = false
		return
	end
 
	-- make sure the head exists
	local head = character:FindFirstChild("Head")
	if not head then
		-- disable the beam
		beam.Enabled = false
		return
	end
 
	-- enable the beam
	beam.Enabled = true
 
	-- define origin and finish
	local origin = head.Position
	local finish = mouse.Hit.p
 
	-- move the attachments 
	attachment0.Position = origin
	attachment1.Position = finish
end)
--[[
	Expand a node by setting its callback environment and then calling it. Any
	further it and describe calls within the callback will be added to the tree.
]]


function TestNode:expand()
	local originalEnv = getfenv(self.callback)
	local callbackEnv = setmetatable({}, { __index = originalEnv })
	for key, value in pairs(self.environment) do
		callbackEnv[key] = value
	end
	setfenv(self.callback, callbackEnv)

	local success, result = xpcall(self.callback, debug.traceback)

	if not success then
		self.loadError = result
	end
end

local TestPlan = {}
TestPlan.__index = TestPlan
--[[**
	Returns a t.union of each key in the table as a t.literal

	@param keyTable The table to get keys from

	@returns True iff the condition is satisfied, false otherwise
**--]]


function t.keyOf(keyTable)
	local keys = {}
	local length = 0
	for key in pairs(keyTable) do
		length = length + 1
		keys[length] = key
	end

	return t.literal(table.unpack(keys, 1, length))
end
--local Array = require(LuauPolyfill.Array)


local isArray = require(LuauPolyfill.Array.isArray)
local arrayFromString = require(LuauPolyfill.Array.from.fromString)
local arrayForEach = require(LuauPolyfill.Array.forEach)
local types = require(LuauPolyfill.types)
type Array<T> = types.Array<T>
type Object = types.Object
type setCallbackFn<T> = types.setCallbackFn<T>
type setCallbackFnWithThisArg<T> = types.setCallbackFnWithThisArg<T>
type Set<T> = types.Set<T>

local inspect = require(LuauPolyfill.util.inspect)

type Set_Statics = {
	new: <T>(iterable: Array<T> | Set<T> | string | nil) -> Set<T>,
}

local Set: Set<any> & Set_Statics = (
	{
		__iter = function(self)
			return next, self._array
		end,
		__tostring = function(self)
			local result = "Set "
			if #self._array > 0 then
				result ..= "(" .. tostring(#self._array) .. ") "
			end
			result ..= inspect(self._array)
			return result
		end,
	} :: any
) :: Set<any> & Set_Statics;
(Set :: any).__index = Set

function Set.new<T>(iterable: Array<T> | Set<T> | string | nil): Set<T>
	local array
	local map = {}
	if iterable ~= nil then
		local arrayIterable

		if typeof(iterable) == "table" then
			if isArray(iterable) then
				arrayIterable = table.clone(iterable)
			else
				local mt = getmetatable(iterable :: any)
				if mt and rawget(mt, "__iter") then
					arrayIterable = iterable :: Set<T>
				elseif _G.__DEV__ then
					error("cannot create array from an object-like table")
				end
			end
		elseif typeof(iterable) == "string" then
			-- TODO Luau: need overloads for `from` to avoid needing the manual cast
			arrayIterable = arrayFromString(iterable :: string) :: Array<string>
		else
			error(("cannot create array from value of type `%s`"):format(typeof(iterable)))
		end

		if arrayIterable then
			array = table.create(#arrayIterable)
			for _, element in arrayIterable do
				if not map[element] then
					map[element] = true
					table.insert(array, element)
				end
			end
		else
			array = {}
		end
	else
		array = {}
	end

	return (setmetatable({
		size = #array,
		_map = map,
		_array = array,
	}, Set) :: any) :: Set<T>
end

function Set:add(value)
	if not self._map[value] then
		-- Luau FIXME: analyze should know self is Set<T> which includes size as a number
		self.size = self.size :: number + 1
		self._map[value] = true
		table.insert(self._array, value)
	end
	return self
end

function Set:clear()
	self.size = 0
	table.clear(self._map)
	table.clear(self._array)
end

function Set:delete(value): boolean
	if not self._map[value] then
		return false
	end
	-- Luau FIXME: analyze should know self is Map<K, V> which includes size as a number
	self.size = self.size :: number - 1
	self._map[value] = nil
	local index = table.find(self._array, value)
	if index then
		table.remove(self._array, index)
	end
	return true
end
-- functions



function onDied()
	stopLoopedSounds()
end

local fallCount = 0
local fallSpeed = 0
function onStateFall(state, sound)
	fallCount = fallCount + 1
	if state then
		sound.Volume = 0
		sound:Play()
		Spawn( function()
			local t = 0
			local thisFall = fallCount
			while t < 1.5 and fallCount == thisFall do
				local vol = math.max(t - 0.3 , 0)
				sound.Volume = vol
				wait(0.1)
				t = t + 0.1
			end
		end)
	else
		sound:Stop()
	end
	fallSpeed = math.max(fallSpeed, math.abs(Head.Velocity.Y))
end


function onStateNoStop(state, sound)
	if state then
		sound:Play()
	end
end


function onRunning(speed)
	sClimbing:Stop()
	sSwimming:Stop()
	if (prevState == "FreeFall" and fallSpeed > 0.1) then
		local vol = math.min(1.0, math.max(0.0, (fallSpeed - 50) / 110))
		sLanding.Volume = vol
		sLanding:Play()
		fallSpeed = 0
	end
	if speed>0.5 then
		sRunning:Play()
		sRunning.Pitch = speed / 8.0
	else
		sRunning:Stop()
	end
	prevState = "Run"
end

function onSwimming(speed)
	if (prevState ~= "Swim" and speed > 0.1) then
		local volume = math.min(1.0, speed / 350)
		sSplash.Volume = volume
		sSplash:Play()
		prevState = "Swim"
	end
	sClimbing:Stop()
	sRunning:Stop()
	sSwimming.Pitch = 1.6
	sSwimming:Play()
end

function onClimbing(speed)
	sRunning:Stop()
	sSwimming:Stop()	
	if speed>0.01 then
		sClimbing:Play()
		sClimbing.Pitch = speed / 5.5
	else
		sClimbing:Stop()
	end
	prevState = "Climb"
end
-- Note: Overrides base class GetIsJumping with get-and-clear behavior to do a single jump
-- rather than sustained jumping. This is only to preserve the current behavior through the refactor.


function DynamicThumbstick:GetIsJumping()
	local wasJumping = self.isJumping
	self.isJumping = false
	return wasJumping
end

function DynamicThumbstick:EnableAutoJump(enable) -- Remove on FFlagUserDTDoesNotForceAutoJump
	if FFlagUserDTDoesNotForceAutoJump then
		return
	end
	local humanoid = LocalPlayer.Character and LocalPlayer.Character:FindFirstChildOfClass("Humanoid")
	if humanoid then
		if enable then
			self.shouldRevertAutoJumpOnDisable = (humanoid.AutoJumpEnabled == false) and (LocalPlayer.DevTouchMovementMode == Enum.DevTouchMovementMode.UserChoice)
			humanoid.AutoJumpEnabled = true
		elseif self.shouldRevertAutoJumpOnDisable then
			humanoid.AutoJumpEnabled = false
		end
	end
end

function DynamicThumbstick:Enable(enable, uiParentFrame)
	if enable == nil then return false end			-- If nil, return false (invalid argument)
	enable = enable and true or false				-- Force anything non-nil to boolean before comparison
	if self.enabled == enable then return true end	-- If no state change, return true indicating already in requested state

	if enable then
		-- Enable
		if not self.thumbstickFrame then
			self:Create(uiParentFrame)
		end

		self:BindContextActions()

		if not FFlagUserDTDoesNotTrackTools then
			if LocalPlayer.Character then
				self:OnCharacterAdded(LocalPlayer.Character)
			else
				LocalPlayer.CharacterAdded:Connect(function(char)
					self:OnCharacterAdded(char)
				end)
			end
		end
	else
		ContextActionService:UnbindAction(DYNAMIC_THUMBSTICK_ACTION_NAME)
		-- Disable
		self:OnInputEnded() -- Cleanup
	end

	self.enabled = enable
	self.thumbstickFrame.Visible = enable
end

function DynamicThumbstick:OnCharacterAdded(char) -- Remove on FFlagUserDTDoesNotTrackTools
	assert(not FFlagUserDTDoesNotTrackTools)

	for _, child in ipairs(char:GetChildren()) do
		if child:IsA("Tool") then
			self.toolEquipped = child
		end
	end

	char.ChildAdded:Connect(function(child)
		if child:IsA("Tool") then
			self.toolEquipped = child
		elseif child:IsA("Humanoid") then
			self:EnableAutoJump(true) -- Remove on FFlagUserDTDoesNotForceAutoJump
		end
	end)
	char.ChildRemoved:Connect(function(child)
		if child == self.toolEquipped then
			self.toolEquipped = nil
		end
	end)

	self.humanoid = char:FindFirstChildOfClass("Humanoid")
	if self.humanoid then
		self:EnableAutoJump(true) -- Remove on FFlagUserDTDoesNotForceAutoJump
	end
end
---------END RIGHT DOOR



game.Workspace.backdoorleft.p1.CFrame = game.Workspace.backdoorleft.p1.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p2.CFrame = game.Workspace.backdoorleft.p2.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p3.CFrame = game.Workspace.backdoorleft.p3.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p4.CFrame = game.Workspace.backdoorleft.p4.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p5.CFrame = game.Workspace.backdoorleft.p5.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p6.CFrame = game.Workspace.backdoorleft.p6.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p7.CFrame = game.Workspace.backdoorleft.p7.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p8.CFrame = game.Workspace.backdoorleft.p8.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p9.CFrame = game.Workspace.backdoorleft.p9.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p10.CFrame = game.Workspace.backdoorleft.p10.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p11.CFrame = game.Workspace.backdoorleft.p11.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p12.CFrame = game.Workspace.backdoorleft.p12.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p13.CFrame = game.Workspace.backdoorleft.p13.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p14.CFrame = game.Workspace.backdoorleft.p14.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p15.CFrame = game.Workspace.backdoorleft.p15.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p16.CFrame = game.Workspace.backdoorleft.p16.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p17.CFrame = game.Workspace.backdoorleft.p17.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p18.CFrame = game.Workspace.backdoorleft.p18.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p19.CFrame = game.Workspace.backdoorleft.p19.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p20.CFrame = game.Workspace.backdoorleft.p20.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
--Made by Stickmasterluke




local sp=script.Parent


local tauntcooldown=10

local originalgrip=CFrame.Angles(math.pi/2,0,0)+Vector3.new(0,-.25,-1.4)

local currentgrip=originalgrip

local debris=game:GetService("Debris")
local enabled=true
local taunting=false
local lasttaunt=0

function waitfor(parent,name)
	while true do
		local child=parent:FindFirstChild(name)
		if child~=nil then
			return child
		end
		wait()
	end
end

waitfor(sp,"Handle")

function onButton1Down(mouse)
	if not enabled then
		return
	end
	enabled=false
	mouse.Icon="rbxasset://textures\\GunWaitCursor.png"
	wait(.75)
	mouse.Icon="rbxasset://textures\\GunCursor.png"
	enabled=true
end

function swordUp()
	currentgrip=originalgrip
end

function swordOut()
	currentgrip=originalgrip*CFrame.Angles(math.pi/4,.4,0)
end

function spinsword(spintime)
	delay(0,function()
		local startspin=tick()
		local endspin=startspin+spintime
		while tick()<endspin do
			sp.Grip=currentgrip*CFrame.Angles(math.pi*2*((tick()-startspin)/spintime),0,0)
			wait()
		end
		sp.Grip=currentgrip
	end)
end

sp.Equipped:connect(function(mouse)
	equipped=true
	local currentlast=lastequipped
	if mouse==nil then
		print("Mouse not found")
		return 
	end
	mouse.Icon="rbxasset://textures\\GunCursor.png"
	mouse.Button1Down:connect(function()
		onButton1Down(mouse)
	end)
	waitfor(sp,"Taunting")
	waitfor(sp,"Taunt")
	--[[waitfor(sp,"Summon")
	mouse.KeyDown:connect(function(key)
		key=string.lower(key)
		if key=="l" or key=="t" or key=="g" or key=="e" then
			local h=sp.Parent:FindFirstChild("Humanoid")
			if h~=nil and (not sp.Taunting.Value) and lasttaunt+tauntcooldown<tick() then
				lasttaunt=tick()
				sp.Taunting.Value=true
				h.WalkSpeed=0
				tauntanim=h:LoadAnimation(sp.Taunt)
				tauntanim:Play()
				wait(4)
				sp.Summon.Value=not sp.Summon.Value
				wait(1)
				h.WalkSpeed=16
				sp.Taunting.Value=false
			end
		end
	end)
	--]]
end)

sp.Unequipped:connect(function()
	equipped=false
end)

waitfor(sp,"RunAnim")
sp.RunAnim.Changed:connect(function()
	local h=sp.Parent:FindFirstChild("Humanoid")
	local t=sp.Parent:FindFirstChild("Torso")
	local anim=sp:FindFirstChild(sp.RunAnim.Value)
	if anim and t and h then
		theanim=h:LoadAnimation(anim)
		if theanim and h.Health>0 then
			theanim:Play()
			if sp.RunAnim.Value=="RightSlash" or sp.RunAnim.Value=="LeftSlash" or sp.RunAnim.Value=="OverHeadSwing" then
				spinsword(.5)
			end
			if sp.RunAnim.Value=="OverHeadSwing" then
				wait(.25)
				swordOut()
				wait(.5)
				swordUp()
				sp.Grip=currentgrip
			elseif sp.RunAnim.Value=="OverHeadSwingFast" then
				wait(.125)
				swordOut()
				wait(.25)
				swordUp()
				sp.Grip=currentgrip
			end
		end
	end
end)

function tagHumanoid(humanoid,player)
	for i,v in ipairs(humanoid:GetChildren()) do
		if v.Name=="creator" then
			v:remove()
		end
	end
	local creator_tag=Instance.new("ObjectValue")
	creator_tag.Value=player
	creator_tag.Name="creator"
	creator_tag.Parent=humanoid
	debris:AddItem(creator_tag,1)
end
--Made by Repressed_Memories
-- Edited by Truenus


local component = script.Parent.Parent
local car = script.Parent.Parent.Parent.Parent.Car.Value
local mouse = game.Players.LocalPlayer:GetMouse()
local leftsignal = "z"
local rightsignal = "c"
local hazards = "x"
local hazardson = false
local lefton = false
local righton = false
local leftlight = car.Body.Lights.Left.TurnSignal.TSL
local rightlight = car.Body.Lights.Right.TurnSignal.TSL
local leftfront = car.Body.Lights.Left.TurnSignal
local rightfront = car.Body.Lights.Right.TurnSignal
local signalblinktime = 0.32
local neonleft = car.Body.Lights.Left.TurnSignal2
local neonright = car.Body.Lights.Right.TurnSignal2
local off =  BrickColor.New("Mid ray")
local on = BrickColor.New("New Yeller")
mouse.KeyDown:connect(function(lkey)
	local key = string.lower(lkey)
	if key == leftsignal then
		if lefton == false then
			lefton = true
			repeat
				neonleft.BrickColor = on
				leftlight.Enabled = true
				neonleft.Material = "Neon"
				leftfront.Material = "Neon"
				component.TurnSignal:play()
				wait(signalblinktime)
				neonleft.BrickColor = off
				component.TurnSignal:play()
				neonleft.Material = "SmoothPlastic"
				leftfront.Material = "SmoothPlastic"
				leftlight.Enabled = false
				wait(signalblinktime)
			until
			lefton == false or righton == true
		elseif lefton == true or righton == true then
			lefton = false
			component.TurnSignal:stop()
			leftlight.Enabled = false
		end
	elseif key == rightsignal then
		if righton == false then
			righton = true
			repeat
				neonright.BrickColor = on
				rightlight.Enabled = true
				neonright.Material = "Neon"
				rightfront.Material = "Neon"
				component.TurnSignal:play()
				wait(signalblinktime)
				neonright.BrickColor = off
				component.TurnSignal:play()
				neonright.Material = "SmoothPlastic"
				rightfront.Material = "SmoothPlastic"
				rightlight.Enabled = false
				wait(signalblinktime)
			until
			righton == false or lefton == true
		elseif righton == true or lefton == true then
			righton = false
			component.TurnSignal:stop()
			rightlight.Enabled = false
		end
	elseif key == hazards then
		if hazardson == false then
			hazardson = true
			repeat
				neonright.BrickColor = on
				neonleft.BrickColor = on
				neonright.Material = "Neon"
				rightfront.Material = "Neon"
				neonleft.Material = "Neon"
				leftfront.Material = "Neon"
				component.TurnSignal:play()
				rightlight.Enabled = true
				leftlight.Enabled = true
				wait(signalblinktime)
				neonright.BrickColor = off
				neonleft.BrickColor = off
				component.TurnSignal:play()
				neonright.Material = "SmoothPlastic"
				rightfront.Material = "SmoothPlastic"
				neonleft.Material = "SmoothPlastic"
				leftfront.Material = "SmoothPlastic"
				rightlight.Enabled = false
				leftlight.Enabled = false
				wait(signalblinktime)
			until
			hazardson == false
		elseif hazardson == true then
			hazardson = false
			component.TurnSignal:stop()
			rightlight.Enabled = false
			leftlight.Enabled = false
		end
	end
end)