Prompt: -- light functions

Response:
F.SignalLeft = function(flash_rate, state, active, tb, type, seq, max_segs, current_segment)
	if active then
		if not seq then
			if state then
				if type == "Halogen" then
					local t = TweenInfo.new(flash_rate / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

					local gtwe = TweenService:Create(tb[5], t, {ImageTransparency = 0})
					gtwe:Play()

					for idx, child in pairs(lights.LeftInd:GetDescendants()) do
						if child:IsA("SpotLight") then
							local tw = TweenService:Create(child, t, {Brightness = 1, Range = 16})
							tw:Play()
						elseif child.Name == "LN" then
							local tw = TweenService:Create(child, t, {Transparency = 0.02})
							tw:Play()
						end
					end
				elseif type == "LED" then
					local t = TweenInfo.new(flash_rate / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

					local gtwe = TweenService:Create(tb[5], t, {ImageTransparency = 0})
					gtwe:Play()

					for idx, child in pairs(lights.LeftInd:GetDescendants()) do
						if child:IsA("SpotLight") then
							child.Brightness = 1
							child.Range = 16
						elseif child.Name == "LN" then
							child.Transparency = 0.02
						end
					end
				end
				wait(flash_rate)
			else
				if type == "Halogen" then
					local t = TweenInfo.new(flash_rate / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

					local gtwe = TweenService:Create(tb[5], t, {ImageTransparency = 1})
					gtwe:Play()

					for idx, child in pairs(lights.LeftInd:GetDescendants()) do
						if child:IsA("SpotLight") then
							local tw = TweenService:Create(child, t, {Brightness = 0, Range = 0})
							tw:Play()
						elseif child.Name == "LN" then
							local tw = TweenService:Create(child, t, {Transparency = 1})
							tw:Play()
						end
					end
				elseif type == "LED" then
					local t = TweenInfo.new(flash_rate / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

					local gtwe = TweenService:Create(tb[5], t, {ImageTransparency = 1})
					gtwe:Play()

						for idx, child in pairs(lights.LeftInd:GetDescendants()) do
						if child:IsA("SpotLight") then
							child.Brightness = 0
							child.Range = 0
						elseif child.Name == "LN" then
							child.Transparency = 1
						end
					end
				end
				wait(flash_rate)
			end
		else
			if state then
				if type == "Halogen" then
					local t = TweenInfo.new(flash_rate / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

					local gtwe = TweenService:Create(tb[5], t, {ImageTransparency = 0})
					gtwe:Play()

					for idx, child in pairs(lights.LeftInd:GetDescendants()) do
						if child.Name == "SI"..tostring(current_segment) then
							local tw = TweenService:Create(child, t, {Transparency = 0.02})
							tw:Play()
						end
					end
				elseif type == "LED" then
					for idx, child in pairs(lights.LeftInd:GetDescendants()) do
						if child.Name == "SI"..tostring(current_segment) then
							child.Transparency = 0.02
						end
					end
				end
			else
				if type == "Halogen" then
					local t = TweenInfo.new(flash_rate / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

					local gtwe = TweenService:Create(tb[5], t, {ImageTransparency = 1})
					gtwe:Play()

					for idx, child in pairs(lights.LeftInd:GetDescendants()) do
						if string.sub(child.Name, 1, 2) == "SI" then
							local tw = TweenService:Create(child, t, {Transparency = 1})
							tw:Play()
						end
					end
				elseif type == "LED" then
					for idx, child in pairs(lights.LeftInd:GetDescendants()) do
						if string.sub(child.Name, 1, 2) == "SI" then
							child.Transparency = 1
						end
					end
				end
			end
		end
	else
		if not seq then
			if type == "Halogen" then
				local t = TweenInfo.new(flash_rate / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

				local gtwe = TweenService:Create(tb[5], t, {ImageTransparency = 1})
				gtwe:Play()

				for idx, child in pairs(lights.LeftInd:GetDescendants()) do
					if child:IsA("SpotLight") then
						local tw = TweenService:Create(child, t, {Brightness = 0, Range = 0})
						tw:Play()
					elseif child.Name == "LN" then
						local tw = TweenService:Create(child, t, {Transparency = 1})
						tw:Play()
					end
				end
			elseif type == "LED" then
				for idx, child in pairs(lights.LeftInd:GetDescendants()) do
					if child:IsA("SpotLight") then
						child.Brightness = 0
						child.Range = 0
					elseif child.Name == "LN" then
						child.Transparency = 1
					end
				end
			end
			wait(flash_rate)
		else
			if state then
				if type == "Halogen" then
					local t = TweenInfo.new(flash_rate / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

					local gtwe = TweenService:Create(tb[5], t, {ImageTransparency = 0})
					gtwe:Play()

					for idx, child in pairs(lights.LeftInd:GetDescendants()) do
						if child.Name == "SI"..tostring(current_segment) then
							local tw = TweenService:Create(child, t, {Transparency = 0.02})
							tw:Play()
						end
					end
				elseif type == "LED" then
					for idx, child in pairs(lights.LeftInd:GetDescendants()) do
						if child.Name == "SI"..tostring(current_segment) then
							child.Transparency = 0.02
						end
					end
				end
			else
				if type == "Halogen" then
					local t = TweenInfo.new(flash_rate / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

					local gtwe = TweenService:Create(tb[5], t, {ImageTransparency = 1})
					gtwe:Play()

					for idx, child in pairs(lights.LeftInd:GetDescendants()) do
						if string.sub(child.Name, 1, 2) == "SI" then
							local tw = TweenService:Create(child, t, {Transparency = 1})
							tw:Play()
						end
					end
				elseif type == "LED" then
					for idx, child in pairs(lights.LeftInd:GetDescendants()) do
						if string.sub(child.Name, 1, 2) == "SI" then
							child.Transparency = 1
						end
					end
				end
			end
		end
	end
end

F.SignalRight = function(flash_rate, state, active, tb, type, seq, max_segs, current_segment)
	if active then
		if not seq then
			if state then
				if type == "Halogen" then
					local t = TweenInfo.new(flash_rate / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

					local gtwe = TweenService:Create(tb[6], t, {ImageTransparency = 0})
					gtwe:Play()

					for idx, child in pairs(lights.RightInd:GetDescendants()) do
						if child:IsA("SpotLight") then
							local tw = TweenService:Create(child, t, {Brightness = 1, Range = 16})
							tw:Play()
						elseif child.Name == "LN" then
							local tw = TweenService:Create(child, t, {Transparency = 0.02})
							tw:Play()
						end
					end
				elseif type == "LED" then
					local t = TweenInfo.new(flash_rate / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

					local gtwe = TweenService:Create(tb[6], t, {ImageTransparency = 0})
					gtwe:Play()

					for idx, child in pairs(lights.RightInd:GetDescendants()) do
						if child:IsA("SpotLight") then
							child.Brightness = 1
							child.Range = 16
						elseif child.Name == "LN" then
							child.Transparency = 0.02
						end
					end
				end
				wait(flash_rate)
			else
				if type == "Halogen" then
					local t = TweenInfo.new(flash_rate / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

					local gtwe = TweenService:Create(tb[6], t, {ImageTransparency = 1})
					gtwe:Play()

					for idx, child in pairs(lights.RightInd:GetDescendants()) do
						if child:IsA("SpotLight") then
							local tw = TweenService:Create(child, t, {Brightness = 0, Range = 0})
							tw:Play()
						elseif child.Name == "LN" then
							local tw = TweenService:Create(child, t, {Transparency = 1})
							tw:Play()
						end
					end
				elseif type == "LED" then
					local t = TweenInfo.new(flash_rate / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

					local gtwe = TweenService:Create(tb[6], t, {ImageTransparency = 1})
					gtwe:Play()

					for idx, child in pairs(lights.RightInd:GetDescendants()) do
						if child:IsA("SpotLight") then
							child.Brightness = 0
							child.Range = 0
						elseif child.Name == "LN" then
							child.Transparency = 1
						end
					end
				end
				wait(flash_rate)
			end
		else
			if state then
				if type == "Halogen" then
					local t = TweenInfo.new(flash_rate / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

					local gtwe = TweenService:Create(tb[6], t, {ImageTransparency = 0})
					gtwe:Play()

					for idx, child in pairs(lights.RightInd:GetDescendants()) do
						if child.Name == "SI"..tostring(current_segment) then
							local tw = TweenService:Create(child, t, {Transparency = 0.02})
							tw:Play()
						end
					end
				elseif type == "LED" then
					for idx, child in pairs(lights.RightInd:GetDescendants()) do
						if child.Name == "SI"..tostring(current_segment) then
							child.Transparency = 0.02
						end
					end
				end
			else
				if type == "Halogen" then
					local t = TweenInfo.new(flash_rate / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

					local gtwe = TweenService:Create(tb[6], t, {ImageTransparency = 1})
					gtwe:Play()

					for idx, child in pairs(lights.RightInd:GetDescendants()) do
						if string.sub(child.Name, 1, 2) == "SI" then
							local tw = TweenService:Create(child, t, {Transparency = 1})
							tw:Play()
						end
					end
				elseif type == "LED" then
					for idx, child in pairs(lights.RightInd:GetDescendants()) do
						if string.sub(child.Name, 1, 2) == "SI" then
							child.Transparency = 1
						end
					end
				end
			end
		end
	else
		if not seq then
			if type == "Halogen" then
				local t = TweenInfo.new(flash_rate / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

				local gtwe = TweenService:Create(tb[6], t, {ImageTransparency = 1})
				gtwe:Play()

				for idx, child in pairs(lights.RightInd:GetDescendants()) do
					if child:IsA("SpotLight") then
						local tw = TweenService:Create(child, t, {Brightness = 0, Range = 0})
						tw:Play()
					elseif child.Name == "LN" then
						local tw = TweenService:Create(child, t, {Transparency = 1})
						tw:Play()
					end
				end
			elseif type == "LED" then
				for idx, child in pairs(lights.RightInd:GetDescendants()) do
					if child:IsA("SpotLight") then
						child.Brightness = 0
						child.Range = 0
					elseif child.Name == "LN" then
						child.Transparency = 1
					end
				end
			end
			wait(flash_rate)
		else
			if state then
				if type == "Halogen" then
					local t = TweenInfo.new(flash_rate / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

					local gtwe = TweenService:Create(tb[6], t, {ImageTransparency = 0})
					gtwe:Play()

					for idx, child in pairs(lights.RightInd:GetDescendants()) do
						if child.Name == "SI"..tostring(current_segment) then
							local tw = TweenService:Create(child, t, {Transparency = 0.02})
							tw:Play()
						end
					end
				elseif type == "LED" then
					for idx, child in pairs(lights.RightInd:GetDescendants()) do
						if child.Name == "SI"..tostring(current_segment) then
							child.Transparency = 0.02
						end
					end
				end
			else
				if type == "Halogen" then
					local t = TweenInfo.new(flash_rate / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

					local gtwe = TweenService:Create(tb[6], t, {ImageTransparency = 1})
					gtwe:Play()

					for idx, child in pairs(lights.RightInd:GetDescendants()) do
						if string.sub(child.Name, 1, 2) == "SI" then
							local tw = TweenService:Create(child, t, {Transparency = 1})
							tw:Play()
						end
					end
				elseif type == "LED" then
					for idx, child in pairs(lights.RightInd:GetDescendants()) do
						if string.sub(child.Name, 1, 2) == "SI" then
							child.Transparency = 1
						end
					end
				end
			end
		end
	end
end

F.Hazards = function(flash_rate, state, active, tb, type, seq, max_segs, current_segment)
	if active then
		if not seq then
			if state then
				if type == "Halogen" then
					local t = TweenInfo.new(flash_rate / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

					local gtwe1 = TweenService:Create(tb[5], t, {ImageTransparency = 0})
					local gtwe2 = TweenService:Create(tb[6], t, {ImageTransparency = 0})
					gtwe1:Play()
					gtwe2:Play()

					for idx, child in pairs(lights.LeftInd:GetDescendants()) do
						if child:IsA("SpotLight") then
						local tw = TweenService:Create(child, t, {Brightness = 1, Range = 16})
							tw:Play()
						elseif child.Name == "LN" then
							local tw = TweenService:Create(child, t, {Transparency = 0.02})
							tw:Play()
						end
					end

					for idx, child in pairs(lights.RightInd:GetDescendants()) do
						if child:IsA("SpotLight") then
							local tw = TweenService:Create(child, t, {Brightness = 1, Range = 16})
							tw:Play()
						elseif child.Name == "LN" then
							local tw = TweenService:Create(child, t, {Transparency = 0.02})
							tw:Play()
						end
					end
				elseif type == "LED" then
					local t = TweenInfo.new(flash_rate / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

					local gtwe1 = TweenService:Create(tb[5], t, {ImageTransparency = 0})
					local gtwe2 = TweenService:Create(tb[6], t, {ImageTransparency = 0})
					gtwe1:Play()
					gtwe2:Play()

					for idx, child in pairs(lights.LeftInd:GetDescendants()) do
						if child:IsA("SpotLight") then
							child.Brightness = 2
							child.Range = 16
						elseif child.Name == "LN" then
							child.Transparency = 0
						end
					end

					for idx, child in pairs(lights.RightInd:GetDescendants()) do
						if child:IsA("SpotLight") then
							child.Brightness = 2
							child.Range = 16
						elseif child.Name == "LN" then
							child.Transparency = 0
						end
					end
				end

				wait(flash_rate)
			else
				if type == "Halogen" then
					local t = TweenInfo.new(flash_rate / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

					local gtwe1 = TweenService:Create(tb[5], t, {ImageTransparency = 1})
					local gtwe2 = TweenService:Create(tb[6], t, {ImageTransparency = 1})
					gtwe1:Play()
					gtwe2:Play()

					for idx, child in pairs(lights.LeftInd:GetDescendants()) do
						if child:IsA("SpotLight") then
							local tw = TweenService:Create(child, t, {Brightness = 0, Range = 0})
							tw:Play()
						elseif child.Name == "LN" then
							local tw = TweenService:Create(child, t, {Transparency = 1})
							tw:Play()
						end
					end

					for idx, child in pairs(lights.RightInd:GetDescendants()) do
						if child:IsA("SpotLight") then
							local tw = TweenService:Create(child, t, {Brightness = 0, Range = 0})
							tw:Play()
						elseif child.Name == "LN" then
							local tw = TweenService:Create(child, t, {Transparency = 1})
							tw:Play()
						end
					end
				elseif type == "LED" then
					local t = TweenInfo.new(flash_rate / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

					local gtwe1 = TweenService:Create(tb[5], t, {ImageTransparency = 1})
					local gtwe2 = TweenService:Create(tb[6], t, {ImageTransparency = 1})
					gtwe1:Play()
					gtwe2:Play()

					for idx, child in pairs(lights.LeftInd:GetDescendants()) do
						if child:IsA("SpotLight") then
							child.Brightness = 0
							child.Range = 0
						elseif child.Name == "LN" then
							child.Transparency = 1
						end
					end

					for idx, child in pairs(lights.RightInd:GetDescendants()) do
						if child:IsA("SpotLight") then
							child.Brightness = 0
							child.Range = 0
						elseif child.Name == "LN" then
							child.Transparency = 1
						end
					end
				end
				wait(flash_rate)
			end
		else
			if state then
				if type == "Halogen" then
					local t = TweenInfo.new(flash_rate / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

					local gtwe1 = TweenService:Create(tb[5], t, {ImageTransparency = 0})
					local gtwe2 = TweenService:Create(tb[6], t, {ImageTransparency = 0})
					gtwe1:Play()
					gtwe2:Play()

					for idx, child in pairs(lights.LeftInd:GetDescendants()) do
						if child.Name == "SI"..tostring(current_segment) then
							local tw = TweenService:Create(child, t, {Transparency = 0.02})
							tw:Play()
						end
					end

					for idx, child in pairs(lights.RightInd:GetDescendants()) do
						if child.Name == "SI"..tostring(current_segment) then
							local tw = TweenService:Create(child, t, {Transparency = 0.02})
							tw:Play()
						end
					end
				elseif type == "LED" then
					local t = TweenInfo.new(flash_rate / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

					local gtwe1 = TweenService:Create(tb[5], t, {ImageTransparency = 0})
					local gtwe2 = TweenService:Create(tb[6], t, {ImageTransparency = 0})
					gtwe1:Play()
					gtwe2:Play()

					for idx, child in pairs(lights.LeftInd:GetDescendants()) do
						if child.Name == "SI"..tostring(current_segment) then
							child.Transparency = 0.02
						end
					end

					for idx, child in pairs(lights.RightInd:GetDescendants()) do
						if child.Name == "SI"..tostring(current_segment) then
							child.Transparency = 0.02
						end
					end
				end

				wait(flash_rate)
			else
				if type == "Halogen" then
					local t = TweenInfo.new(flash_rate / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

					local gtwe1 = TweenService:Create(tb[5], t, {ImageTransparency = 1})
					local gtwe2 = TweenService:Create(tb[6], t, {ImageTransparency = 1})
					gtwe1:Play()
					gtwe2:Play()

					for idx, child in pairs(lights.LeftInd:GetDescendants()) do
						if string.sub(child.Name, 1, 2) == "SI" then
							local tw = TweenService:Create(child, t, {Transparency = 1})
							tw:Play()
						end
					end

					for idx, child in pairs(lights.RightInd:GetDescendants()) do
						if string.sub(child.Name, 1, 2) == "SI" then
							local tw = TweenService:Create(child, t, {Transparency = 1})
							tw:Play()
						end
					end
				elseif type == "LED" then
					local t = TweenInfo.new(flash_rate / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

					local gtwe1 = TweenService:Create(tb[5], t, {ImageTransparency = 1})
					local gtwe2 = TweenService:Create(tb[6], t, {ImageTransparency = 1})
					gtwe1:Play()
					gtwe2:Play()

					for idx, child in pairs(lights.LeftInd:GetDescendants()) do
						if string.sub(child.Name, 1, 2) == "SI" then
							child.Transparency = 1
						end
					end

					for idx, child in pairs(lights.RightInd:GetDescendants()) do
						if string.sub(child.Name, 1, 2) == "SI" then
							child.Transparency = 1
						end
					end
				end
				wait(flash_rate)
			end
		end
	else
		if not seq then
			if type == "Halogen" then
				local t = TweenInfo.new(flash_rate / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

				local gtwe1 = TweenService:Create(tb[5], t, {ImageTransparency = 1})
				local gtwe2 = TweenService:Create(tb[6], t, {ImageTransparency = 1})
				gtwe1:Play()
				gtwe2:Play()

				for idx, child in pairs(lights.LeftInd:GetDescendants()) do
					if child:IsA("SpotLight") then
						local tw = TweenService:Create(child, t, {Brightness = 0, Range = 0})
						tw:Play()
					elseif child.Name == "LN" then
						local tw = TweenService:Create(child, t, {Transparency = 1})
						tw:Play()
					end
				end

				for idx, child in pairs(lights.RightInd:GetDescendants()) do
					if child:IsA("SpotLight") then
						local tw = TweenService:Create(child, t, {Brightness = 0, Range = 0})
						tw:Play()
					elseif child.Name == "LN" then
						local tw = TweenService:Create(child, t, {Transparency = 1})
						tw:Play()
					end
				end
			elseif type == "LED" then
				local t = TweenInfo.new(flash_rate / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

				local gtwe1 = TweenService:Create(tb[5], t, {ImageTransparency = 1})
				local gtwe2 = TweenService:Create(tb[6], t, {ImageTransparency = 1})
				gtwe1:Play()
				gtwe2:Play()

				for idx, child in pairs(lights.LeftInd:GetDescendants()) do
					if child:IsA("SpotLight") then
						child.Brightness = 0
						child.Range = 0
					elseif child.Name == "LN" then
						child.Transparency = 1
					end
				end

				for idx, child in pairs(lights.RightInd:GetDescendants()) do
					if child:IsA("SpotLight") then
						child.Brightness = 0
						child.Range = 0
					elseif child.Name == "LN" then
						child.Transparency = 1
					end
				end
			end
			wait(flash_rate)
		else
			if type == "Halogen" then
				local t = TweenInfo.new(flash_rate / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

				local gtwe1 = TweenService:Create(tb[5], t, {ImageTransparency = 1})
				local gtwe2 = TweenService:Create(tb[6], t, {ImageTransparency = 1})
				gtwe1:Play()
				gtwe2:Play()

				for idx, child in pairs(lights.LeftInd:GetDescendants()) do
					if string.sub(child.Name, 1, 2) == "SI" then
						local tw = TweenService:Create(child, t, {Transparency = 1})
						tw:Play()
					end
				end

				for idx, child in pairs(lights.RightInd:GetDescendants()) do
					if string.sub(child.Name, 1, 2) == "SI" then
						local tw = TweenService:Create(child, t, {Transparency = 1})
						tw:Play()
					end
				end
			elseif type == "LED" then
				local t = TweenInfo.new(flash_rate / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

				local gtwe1 = TweenService:Create(tb[5], t, {ImageTransparency = 1})
				local gtwe2 = TweenService:Create(tb[6], t, {ImageTransparency = 1})
				gtwe1:Play()
				gtwe2:Play()

				for idx, child in pairs(lights.LeftInd:GetDescendants()) do
					if string.sub(child.Name, 1, 2) == "SI" then
						child.Transparency = 1
					end
				end

				for idx, child in pairs(lights.RightInd:GetDescendants()) do
					if string.sub(child.Name, 1, 2) == "SI" then
						child.Transparency = 1
					end
				end
			end
			wait(flash_rate)
		end
	end
end

F.Headlights = function(state, fade_time, tb, type)
	if type == "Halogen" then
		if state == 0 then
			local t = TweenInfo.new(fade_time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

			local gtwe1 = TweenService:Create(tb[1], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 1})
			local gtwe2 = TweenService:Create(tb[2], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 1})
			gtwe1:Play()
			gtwe2:Play()

			if plactive then
				for idx, child in pairs(lights.Headlights.Low:GetDescendants()) do
					if child:IsA("SpotLight") then
						local tw = TweenService:Create(child, t, {Brightness = 0, Range = 0})
						tw:Play()
					elseif child.Name == "LN" then
						local tw = TweenService:Create(child, t, {Transparency = 0.7})
						tw:Play()
					end
				end
				for idx, child in pairs(lights.Headlights.High:GetDescendants()) do
					if child:IsA("SpotLight") then
						local tw = TweenService:Create(child, t, {Brightness = 0, Range = 0})
						tw:Play()
					elseif child.Name == "LN" then
						local tw = TweenService:Create(child, t, {Transparency = 1})
						tw:Play()
					end
				end
			elseif not plactive then
				for idx, child in pairs(lights.Headlights:GetDescendants()) do
					if child:IsA("SpotLight") then
						local tw = TweenService:Create(child, t, {Brightness = 0, Range = 0})
						tw:Play()
					elseif child.Name == "LN" then
						local tw = TweenService:Create(child, t, {Transparency = 1})
						tw:Play()
					end
				end
			end
		elseif state == 1 then
			local t = TweenInfo.new(fade_time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

			local gtwe1 = TweenService:Create(tb[1], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 1})
			local gtwe2 = TweenService:Create(tb[2], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 0})
			gtwe1:Play()
			gtwe2:Play()

			for idx, child in pairs(lights.Headlights.Low:GetDescendants()) do
				if child:IsA("SpotLight") then
					local tw = TweenService:Create(child, t, {Brightness = 2, Range = 48})
					tw:Play()
				elseif child.Name == "LN" then
					local tw = TweenService:Create(child, t, {Transparency = 0.2})
					tw:Play()
				end
			end
		elseif state == 2 then
			local t = TweenInfo.new(fade_time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

			local gtwe1 = TweenService:Create(tb[1], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 0})
			local gtwe2 = TweenService:Create(tb[2], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 1})
			gtwe1:Play()
			gtwe2:Play()

			for idx, child in pairs(lights.Headlights:GetDescendants()) do
				if child:IsA("SpotLight") then
					local tw = TweenService:Create(child, t, {Brightness = 3.5, Range = 60})
					tw:Play()
				elseif child.Name == "LN" then
					local tw = TweenService:Create(child, t, {Transparency = 0.02})
					tw:Play()
				end
			end
		elseif state == 3 then
			local t = TweenInfo.new(fade_time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

			local gtwe1 = TweenService:Create(tb[1], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 0})
			local gtwe2 = TweenService:Create(tb[2], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 1})
			gtwe1:Play()
			gtwe2:Play()

			for idx, child in pairs(lights.Headlights:GetDescendants()) do
				if child:IsA("SpotLight") then
					local tw = TweenService:Create(child, t, {Brightness = 4.25, Range = 60})
					tw:Play()
				elseif child.Name == "LN" then
					local tw = TweenService:Create(child, t, {Transparency = 0.02})
					tw:Play()
				end
			end
		end
	elseif type == "LED" then
		if state == 0 then
			local t = TweenInfo.new(fade_time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

			local gtwe1 = TweenService:Create(tb[1], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 1})
			local gtwe2 = TweenService:Create(tb[2], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 1})
			gtwe1:Play()
			gtwe2:Play()

			if plactive then
				for idx, child in pairs(lights.Headlights.Low:GetDescendants()) do
					if child:IsA("SpotLight") then
						child.Brightness = 0
						child.Range = 0
					elseif child.Name == "LN" then
						child.Transparency = 0.7
					end
				end
				for idx, child in pairs(lights.Headlights.High:GetDescendants()) do
					if child:IsA("SpotLight") then
						child.Brightness = 0
						child.Range = 0
					elseif child.Name == "LN" then
						child.Transparency = 1
					end
				end
			elseif not plactive then
				for idx, child in pairs(lights.Headlights:GetDescendants()) do
					if child:IsA("SpotLight") then
						child.Brightness = 0
						child.Range = 0
					elseif child.Name == "LN" then
						child.Transparency = 1
					end
				end
			end
		elseif state == 1 then
			local t = TweenInfo.new(fade_time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

			local gtwe1 = TweenService:Create(tb[1], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 1})
			local gtwe2 = TweenService:Create(tb[2], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 0})
			gtwe1:Play()
			gtwe2:Play()

			for idx, child in pairs(lights.Headlights:GetDescendants()) do
				if child:IsA("SpotLight") then
					child.Brightness = 2
					child.Range = 48
				elseif child.Name == "LN" then
					child.Transparency = 0.2
				end
			end
		elseif state == 2 then
			local t = TweenInfo.new(fade_time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

			local gtwe1 = TweenService:Create(tb[1], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 0})
			local gtwe2 = TweenService:Create(tb[2], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 1})
			gtwe1:Play()
			gtwe2:Play()

			for idx, child in pairs(lights.Headlights:GetDescendants()) do
				if child:IsA("SpotLight") then
					child.Brightness = 3.5
					child.Range = 60
				elseif child.Name == "LN" then
					child.Transparency = 0.02
				end
			end
		elseif state == 3 then
			local t = TweenInfo.new(fade_time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

			local gtwe1 = TweenService:Create(tb[1], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 0})
			local gtwe2 = TweenService:Create(tb[2], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 1})
			gtwe1:Play()
			gtwe2:Play()

			for idx, child in pairs(lights.Headlights:GetDescendants()) do
				if child:IsA("SpotLight") then
					child.Brightness = 4.25
					child.Range = 60
				elseif child.Name == "LN" then
					child.Transparency = 0.02
				end
			end
		end
	end
end

F.Popups = function(state, enabled)
	if enabled then
		local motor = PHeadlights.Hinge:WaitForChild("Motor")
		motor.MaxVelocity = 0.08

		if state then
			motor.DesiredAngle = -0.9
		elseif not state then
			motor.DesiredAngle = 0
		end
	end
end

F.PopupLights = function(state, fade_time, tb, type)
	if type == "Halogen" then
		if state == 0 then
			local t = TweenInfo.new(fade_time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

			local gtwe1 = TweenService:Create(tb[1], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 1})
			local gtwe2 = TweenService:Create(tb[2], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 1})
			gtwe1:Play()
			gtwe2:Play()

			if plactive then
				for idx, child in pairs(PHeadlights.Parts.Headlights:GetDescendants()) do
					if child:IsA("SpotLight") then
						local tw = TweenService:Create(child, t, {Brightness = 0, Range = 0})
						tw:Play()
					elseif child.Name == "LN" then
						local tw = TweenService:Create(child, t, {Transparency = 0.7})
						tw:Play()
					end
				end
			elseif not plactive then
				for idx, child in pairs(PHeadlights.Parts.Headlights:GetDescendants()) do
					if child:IsA("SpotLight") then
						local tw = TweenService:Create(child, t, {Brightness = 0, Range = 0})
						tw:Play()
					elseif child.Name == "LN" then
						local tw = TweenService:Create(child, t, {Transparency = 1})
						tw:Play()
					end
				end
			end
		elseif state == 1 then
			local t = TweenInfo.new(fade_time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

			local gtwe1 = TweenService:Create(tb[1], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 1})
			local gtwe2 = TweenService:Create(tb[2], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 0})
			gtwe1:Play()
			gtwe2:Play()

			for idx, child in pairs(PHeadlights.Parts.Headlights:GetDescendants()) do
				if child:IsA("SpotLight") then
					local tw = TweenService:Create(child, t, {Brightness = 2, Range = 48})
					tw:Play()
				elseif child.Name == "LN" then
					local tw = TweenService:Create(child, t, {Transparency = 0.2})
					tw:Play()
				end
			end
		elseif state == 2 then
			local t = TweenInfo.new(fade_time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

			local gtwe1 = TweenService:Create(tb[1], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 0})
			local gtwe2 = TweenService:Create(tb[2], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 1})
			gtwe1:Play()
			gtwe2:Play()

			for idx, child in pairs(PHeadlights.Parts.Headlights:GetDescendants()) do
				if child:IsA("SpotLight") then
					local tw = TweenService:Create(child, t, {Brightness = 3.5, Range = 60})
					tw:Play()
				elseif child.Name == "LN" then
					local tw = TweenService:Create(child, t, {Transparency = 0.02})
					tw:Play()
				end
			end
		elseif state == 3 then
			local t = TweenInfo.new(fade_time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

			local gtwe1 = TweenService:Create(tb[1], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 0})
			local gtwe2 = TweenService:Create(tb[2], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 1})
			gtwe1:Play()
			gtwe2:Play()

			for idx, child in pairs(PHeadlights.Parts.Headlights:GetDescendants()) do
				if child:IsA("SpotLight") then
					local tw = TweenService:Create(child, t, {Brightness = 4.25, Range = 60})
					tw:Play()
				elseif child.Name == "LN" then
					local tw = TweenService:Create(child, t, {Transparency = 0.02})
					tw:Play()
				end
			end
		end
	elseif type == "LED" then
		if state == 0 then
			local t = TweenInfo.new(fade_time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

			local gtwe1 = TweenService:Create(tb[1], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 1})
			local gtwe2 = TweenService:Create(tb[2], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 1})
			gtwe1:Play()
			gtwe2:Play()

			if plactive then
				for idx, child in pairs(lights.Headlights:GetDescendants()) do
					if child:IsA("SpotLight") then
						child.Brightness = 0
						child.Range = 0
					elseif child.Name == "LN" then
						child.Transparency = 0.7
					end
				end
			elseif not plactive then
				for idx, child in pairs(lights.Headlights:GetDescendants()) do
					if child:IsA("SpotLight") then
						child.Brightness = 0
						child.Range = 0
					elseif child.Name == "LN" then
						child.Transparency = 1
					end
				end
			end
		elseif state == 1 then
			local t = TweenInfo.new(fade_time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

			local gtwe1 = TweenService:Create(tb[1], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 1})
			local gtwe2 = TweenService:Create(tb[2], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 0})
			gtwe1:Play()
			gtwe2:Play()

			for idx, child in pairs(lights.Headlights:GetDescendants()) do
				if child:IsA("SpotLight") then
					child.Brightness = 2
					child.Range = 48
				elseif child.Name == "LN" then
					child.Transparency = 0.2
				end
			end
		elseif state == 2 then
			local t = TweenInfo.new(fade_time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

			local gtwe1 = TweenService:Create(tb[1], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 0})
			local gtwe2 = TweenService:Create(tb[2], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 1})
			gtwe1:Play()
			gtwe2:Play()

			for idx, child in pairs(lights.Headlights:GetDescendants()) do
				if child:IsA("SpotLight") then
					child.Brightness = 3.5
					child.Range = 60
				elseif child.Name == "LN" then
					child.Transparency = 0.02
				end
			end
		elseif state == 3 then
			local t = TweenInfo.new(fade_time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

			local gtwe1 = TweenService:Create(tb[1], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 0})
			local gtwe2 = TweenService:Create(tb[2], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 1})
			gtwe1:Play()
			gtwe2:Play()

			for idx, child in pairs(lights.Headlights:GetDescendants()) do
				if child:IsA("SpotLight") then
					child.Brightness = 4.25
					child.Range = 60
				elseif child.Name == "LN" then
					child.Transparency = 0.02
				end
			end
		end
	end
end

F.FogLights = function(state, fade_time, tb, type)
	if state then
		if type == "Halogen" then
			local t = TweenInfo.new(fade_time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

			local gtwe1 = TweenService:Create(tb[4], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 0})
			gtwe1:Play()

			for idx, child in pairs(lights.Fog:GetDescendants()) do
				if child:IsA("SpotLight") then
					local tw = TweenService:Create(child, t, {Brightness = 3.75, Range = 60})
					tw:Play()
				elseif child.Name == "LN" then
					local tw = TweenService:Create(child, t, {Transparency = 0.02})
					tw:Play()
				end
			end
		elseif type == "LED" then
			local t = TweenInfo.new(fade_time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

			local gtwe1 = TweenService:Create(tb[4], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 0})
			gtwe1:Play()

			for idx, child in pairs(lights.Fog:GetDescendants()) do
				if child:IsA("SpotLight") then
					child.Brightness = 3.75
					child.Range = 60
				elseif child.Name == "LN" then
					child.Transparency = 0.02
				end
			end
		end
	elseif not state then
		if type == "Halogen" then
			local t = TweenInfo.new(fade_time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

			local gtwe1 = TweenService:Create(tb[4], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 1})
			gtwe1:Play()

			for idx, child in pairs(lights.Fog:GetDescendants()) do
				if child:IsA("SpotLight") then
					local tw = TweenService:Create(child, t, {Brightness = 0, Range = 0})
					tw:Play()
				elseif child.Name == "LN" then
					local tw = TweenService:Create(child, t, {Transparency = 1})
					tw:Play()
				end
			end
		elseif type == "LED" then
			local t = TweenInfo.new(fade_time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

			local gtwe1 = TweenService:Create(tb[4], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 1})
			gtwe1:Play()

			for idx, child in pairs(lights.Fog:GetDescendants()) do
				if child:IsA("SpotLight") then
					child.Brightness = 0
					child.Range = 0
				elseif child.Name == "LN" then
					child.Transparency = 1
				end
			end
		end
	end
end

F.ParkLights = function(state, tb)
	if state then
		local gtwe = TweenService:Create(tb[3], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 0})
		gtwe:Play()

		plactive = true
	else
		local gtwe = TweenService:Create(tb[3], TweenInfo.new(0.05, Enum.EasingStyle.Quint), {ImageTransparency = 1})
		gtwe:Play()

		plactive = false
	end
end

F.BrakeLights = function(state, fade_time, type)
	if type == "Halogen" then
		if state then
			local t = TweenInfo.new(fade_time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

			for idx, child in pairs(lights.Brake:GetDescendants()) do
				if child:IsA("SpotLight") then
					local tw = TweenService:Create(child, t, {Brightness = 2.5, Range = 38})
					tw:Play()
				elseif child.Name == "LN" then
					local tw = TweenService:Create(child, t, {Transparency = 0.02})
					tw:Play()
				end
			end
		else
			local t = TweenInfo.new(fade_time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

			for idx, child in pairs(lights.Brake:GetDescendants()) do
				if child:IsA("SpotLight") then
					local tw = TweenService:Create(child, t, {Brightness = 0, Range = 0})
					tw:Play()
				elseif child.Name == "LN" then
					local tw = TweenService:Create(child, t, {Transparency = 1})
					tw:Play()
				end
			end
		end
	elseif type == "LED" then
		if state then
			local t = TweenInfo.new(fade_time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

			for idx, child in pairs(lights.Brake:GetDescendants()) do
				if child:IsA("SpotLight") then
					child.Brightness = 3.5
					child.Range = 38
				elseif child.Name == "LN" then
					child.Transparency = 0.02
				end
			end
		else
			local t = TweenInfo.new(fade_time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

			for idx, child in pairs(lights.Brake:GetDescendants()) do
				if child:IsA("SpotLight") then
					child.Brightness = 0
					child.Range = 0
				elseif child.Name == "LN" then
					child.Transparency = 1
				end
			end
		end
	end
end

F.RearLights = function(state, fade_time, type)
	if type == "Halogen" then
		if state == 0 then
			local t = TweenInfo.new(fade_time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

			if plactive then
				for idx, child in pairs(lights.Rear:GetDescendants()) do
					if child:IsA("SpotLight") then
						local tw = TweenService:Create(child, t, {Brightness = 0, Range = 0})
						tw:Play()
					elseif child.Name == "LN" then
						local tw = TweenService:Create(child, t, {Transparency = 0.7})
						tw:Play()
					end
				end
			elseif not plactive then
				for idx, child in pairs(lights.Rear:GetDescendants()) do
					if child:IsA("SpotLight") then
						local tw = TweenService:Create(child, t, {Brightness = 0, Range = 0})
						tw:Play()
					elseif child.Name == "LN" then
						local tw = TweenService:Create(child, t, {Transparency = 1})
						tw:Play()
					end
				end
			end
		elseif state == 1 then
			local t = TweenInfo.new(fade_time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

			for idx, child in pairs(lights.Rear:GetDescendants()) do
				if child:IsA("SpotLight") then
					local tw = TweenService:Create(child, t, {Brightness = 1.5, Range = 25})
					tw:Play()
				elseif child.Name == "LN" then
					local tw = TweenService:Create(child, t, {Transparency = 0.2})
					tw:Play()
				end
			end
		end
	elseif type == "LED" then
		if state == 0 then
			local t = TweenInfo.new(fade_time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

			if plactive then
				for idx, child in pairs(lights.Rear:GetDescendants()) do
					if child:IsA("SpotLight") then
						child.Brightness = 0
						child.Range = 0
					elseif child.Name == "LN" then
						child.Transparency  = 0.7
					end
				end
			elseif not plactive then
				for idx, child in pairs(lights.Rear:GetDescendants()) do
					if child:IsA("SpotLight") then
						child.Brightness = 0
						child.Range = 0
					elseif child.Name == "LN" then
						child.Transparency  = 1
					end
				end
			end
		elseif state == 1 then
			local t = TweenInfo.new(fade_time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

			for idx, child in pairs(lights.Rear:GetDescendants()) do
				if child:IsA("SpotLight") then
					child.Brightness = 1.5
					child.Range = 25
				elseif child.Name == "LN" then
					child.Transparency  = 0.2
				end
			end
		end
	end
end

F.DashboardIndicators = function(headlights, indicators, parklights)

end

F.Reverse = function(state, fade_time, type)
	if type == "Halogen" then
		if state then
			local t = TweenInfo.new(fade_time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

			for idx, child in pairs(lights.Reverse:GetDescendants()) do
				if child:IsA("SpotLight") then
					local tw = TweenService:Create(child, t, {Brightness = 1, Range = 20})
					tw:Play()
				elseif child.Name == "LN" then
					local tw = TweenService:Create(child, t, {Transparency = 0.03})
					tw:Play()
				end
			end
		else
			local t = TweenInfo.new(fade_time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

			for idx, child in pairs(lights.Reverse:GetDescendants()) do
				if child:IsA("SpotLight") then
					local tw = TweenService:Create(child, t, {Brightness = 0, Range = 0})
					tw:Play()
				elseif child.Name == "LN" then
					local tw = TweenService:Create(child, t, {Transparency = 1})
					tw:Play()
				end
			end
		end
	elseif type == "LED" then
		if state then
			local t = TweenInfo.new(fade_time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

			for idx, child in pairs(lights.Reverse:GetDescendants()) do
				if child:IsA("SpotLight") then
					child.Brightness = 1
					child.Range = 20
				elseif child.Name == "LN" then
					child.Transparency = 0.03
				end
			end
		else
			local t = TweenInfo.new(fade_time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

			for idx, child in pairs(lights.Reverse:GetDescendants()) do
				if child:IsA("SpotLight") then
					child.Brightness = 0
					child.Range = 0
				elseif child.Name == "LN" then
					child.Transparency = 1
				end
			end
		end
	end
end

F.IndsOnLeave = function(left, right, hazard, sequential, segs, fr, type)
	event.IndicatorsAfterLeave.Disabled = false
	wait()
	leaveseatevent:Fire(left, right, hazard, sequential, segs, fr, type)
end

event.OnServerEvent:Connect(function(pl, Fnc, ...)
	F[Fnc](...)
end)


Prompt:
-- Written By Kip Turner, Copyright Roblox 2014
-- Updated by Garnold to utilize the new PathfindingService API, 2017

Response:
local UIS = game:GetService("UserInputService")
local PathfindingService = game:GetService("PathfindingService")
local PlayerService = game:GetService("Players")
local RunService = game:GetService("RunService")
local DebrisService = game:GetService('Debris')
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local tweenService = game:GetService("TweenService")

local CameraScript = script:FindFirstAncestor("CameraScript")
local InvisicamModule = require(CameraScript:WaitForChild("Invisicam"))
local OrbitalCamModule = require(CameraScript:WaitForChild('RootCamera'):WaitForChild('OrbitalCamera'))

local Player = PlayerService.LocalPlayer
local PlayerScripts = Player.PlayerScripts

local ControlScript = PlayerScripts:FindFirstChild("ControlScript")
local MasterControl, TouchJump
if ControlScript then
	MasterControl = ControlScript:FindFirstChild("MasterControl")
	if MasterControl then
		local TouchJumpModule = MasterControl:FindFirstChild("TouchJump")
		if TouchJumpModule then
			TouchJump = require(TouchJumpModule)
		end
	end
end

local SHOW_PATH = true

local RayCastIgnoreList = workspace.FindPartOnRayWithIgnoreList

local math_min = math.min
local math_max = math.max
local math_pi = math.pi
local math_atan2 = math.atan2

local Vector3_new = Vector3.new
local Vector2_new = Vector2.new
local CFrame_new = CFrame.new

local CurrentSeatPart = nil
local DrivingTo = nil

local XZ_VECTOR3 = Vector3_new(1, 0, 1)
local ZERO_VECTOR3 = Vector3_new(0, 0, 0)
local ZERO_VECTOR2 = Vector2_new(0, 0)

local lastFailedPosition = nil

local BindableEvent_OnFailStateChanged = nil
if UIS.TouchEnabled then
	BindableEvent_OnFailStateChanged = Instance.new('BindableEvent')
	BindableEvent_OnFailStateChanged.Name = "OnClickToMoveFailStateChange"
	BindableEvent_OnFailStateChanged.Parent = PlayerScripts
end


Prompt:
--[[**
		creates a union type

		@param ... The checks to union

		@returns A function that will return true iff the condition is passed
	**--]]

Response:
	function t.union(...)
		local checks = { ... }
		assert(callbackArray(checks))

		return function(value)
			for _, check in ipairs(checks) do
				if check(value) then
					return true
				end
			end

			return false, "bad type for union"
		end
	end


Prompt: -- Make alias public on class

Response: Expectation.an = Expectation.a


Prompt:
--[=[
	Constructs a new signal.
	@return Signal<T>
]=]

Response:
function Signal.new()
	local self = setmetatable({}, Signal)

	self._bindableEvent = Instance.new("BindableEvent")
	self._argMap = {}
	self._source = ENABLE_TRACEBACK and debug.traceback() or ""

	-- Events in Roblox execute in reverse order as they are stored in a linked list and
	-- new connections are added at the head. This event will be at the tail of the list to
	-- clean up memory.
	self._bindableEvent.Event:Connect(function(key)
		self._argMap[key] = nil

		-- We've been destroyed here and there's nothing left in flight.
		-- Let's remove the argmap too.
		-- This code may be slower than leaving this table allocated.
		if (not self._bindableEvent) and (not next(self._argMap)) then
			self._argMap = nil
		end
	end)

	return self
end


Prompt: -- Set up quest triggers

Response:
for _,trigger in pairs(workspace.QuestTriggers:GetChildren()) do
	local quest = replicatedStorage.Quests:FindFirstChild(trigger.Name)
	if quest then
		trigger.Touched:Connect(function(part)
			local player = players:GetPlayerFromCharacter(part.Parent)
			if player and not script:FindFirstChild(player.Name .. "Deciding") and not player.Quests:FindFirstChild(quest.Name) and not player.CompletedQuests:FindFirstChild(quest.Name) then
				local tag = Instance.new("Model")
				tag.Name = player.Name .. "Deciding"
				tag.Parent = script
				local acceptedQuest
				pcall(function() -- Player might leave during the invoke, causing the tag to stay forever
					acceptedQuest = replicatedStorage.ClientRemotes.OfferQuest:InvokeClient(player, quest)
				end)
				if acceptedQuest then
					local quest = require(questSystem).GiveQuest(player, quest.Name)
					require(questSystem[quest.QuestType.Value]).CheckIfCompleted(player, quest) -- Player may have already met the completion requirements
				end
				wait(2)
				tag:Destroy()
			end
		end)
	else
		warn('Could not find a matching quest in ReplicatedStorage.Quests for the trigger named "' .. trigger.Name .. '"')
	end
end
for _,quest in pairs(replicatedStorage.Quests:GetChildren()) do
	if quest.QuestType.Value == "TouchOrb" then -- Make quest touch connections
		local destinationOrb = quest.Requirements:FindFirstChildOfClass("ObjectValue")
		if destinationOrb and destinationOrb.Value then
			destinationOrb.Value.Touched:Connect(function(part)
				local player = players:GetPlayerFromCharacter(part.Parent)
				if player then
					local matchingQuest = player.Quests:FindFirstChild(quest.Name)
					if matchingQuest then
						require(questSystem.TouchOrb).CheckIfCompleted(player, matchingQuest)
					end
				end
			end)
		end
	end
end


Prompt: --//Controller//--

Response:
for _, StatHolder in pairs(Holder:GetChildren()) do
	if StatHolder:IsA("Frame") then
		local DisplayText = StatHolder.DisplayText
		local DisplayFrame = StatHolder.DisplayFrame

		Player:GetAttributeChangedSignal(StatHolder.Name):Connect(function()
			TweenService:Create(
				DisplayFrame,
				TweenInfo.new(
					0.25,
					Enum.EasingStyle.Linear
				),
				{
					Size = UDim2.new(Player:GetAttribute(StatHolder.Name) / 100, 0, 1, 0)
				}
			):Play()

			DisplayText.Text = Player:GetAttribute(StatHolder.Name) .. " / 100"

		end)

	end

end


Prompt: --[[Transmission]]

Response:
	Tune.TransModes		= {"Semi", "Manual"}								--[[
	[Modes]
		"Semi"		: Clutchless manual shifting, dual clutch transmission
		"Manual"	: Manual shifting with clutch

		>Include within brackets
			eg: {"Semi"} or {"Manual"}
		>First mode is default mode													]]

	--Automatic Settings
	Tune.AutoShiftMode	= "Speed"												--[[
	[Modes]
		"Speed"		: Shifts based on wheel speed
		"RPM"		: Shifts based on RPM											]]
	Tune.AutoUpThresh	= -200		--Automatic upshift point 	(relative to peak RPM, positive = Over-rev)
	Tune.AutoDownThresh = 1400		--Automatic downshift point (relative to peak RPM, positive = Under-rev)

	--Gear Ratios
	Tune.FinalDrive		= 4.06			-- Gearing determines top speed and wheel torque
	Tune.Ratios			= {				-- Higher ratio = more torque, Lower ratio = higher top speed
		--[[Reverse]]	3.70		,	-- Copy and paste a ratio to add a gear
		--[[Neutral]]	0			,	-- Ratios can also be deleted
		--[[ 1 ]]		5.20		,	-- Reverse, Neutral, and 1st gear are required
		--[[ 2 ]]		2.50		,
		--[[ 3 ]]		1.40		,
		--[[ 4 ]]		1.03		,
		--[[ 5 ]]		0.81		,
		--[[ 6 ]]		0.64		,
	}
	Tune.FDMult			= 1.5			-- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)


Prompt: -- Basic settings

Response:
local MAXIMUM_DIFFERENT_ITEMS = 6

local plr = game.Players.LocalPlayer

function getItemTable()

	-- Formulate and return a table of items
	local items = {}
	for _, i in pairs(script.Parent:GetChildren()) do
		if i.Name == "Item" then
			for _=1, i.Count.Value do
				table.insert(items, i.Item.Value.Name)
			end
		end
	end
	return items

end

function refreshOutlines()

	-- Create table of item names
	local items = {}
	for _, i in pairs(script.Parent:GetChildren()) do
		if i.Name == "Item" then
			table.insert(items, i.Item.Value.Name)
		end
	end

	-- Check size
	if #items > 0 then

		-- Create table of connected items
		local connectedItems = {}
		for _, i in pairs(game.ReplicatedStorage.Recipes:GetChildren()) do
			local okay = true
			for _, o in pairs(items) do
				if i.Ingredients:FindFirstChild(o) == nil then
					okay = false
					break
				end
			end
			if okay then
				for _, o in pairs(i.Ingredients:GetChildren()) do
					table.insert(connectedItems, o.Name)
				end
			end
		end

		-- Go through displayed items adding/removing outlines
		for _, i in pairs(script.Parent.Parent.Parent.Display.Container:GetChildren()) do
			if i.Name == "Item" then
				local okay = false
				for n, o in pairs(connectedItems) do
					if o == i.Item.Value.Name then
						okay = true
						table.remove(connectedItems, n)
						break
					end
				end
				i.BlueEdge.Visible = okay
			end
		end

	else

		-- Remove all outlines
		for _, i in pairs(script.Parent.Parent.Parent.Display.Container:GetChildren()) do
			if i.Name == "Item" then
				i.BlueEdge.Visible = false
			end
		end

	end

end

script.Parent.AddItem.OnInvoke = function(item)

	-- Check if there already is an entry for the item
	local existing = nil
	for _, i in pairs(script.Parent:GetChildren()) do
		if i.Name == "Item" then
			if i.Item.Value == item then
				existing = i
				break
			end
		end
	end
	if existing == nil then

		-- Check if the item count maximum has been reached
		local entryCount = #script.Parent:GetChildren() - 5
		if entryCount >= MAXIMUM_DIFFERENT_ITEMS then
			return false
		end

		-- Create an item GUI element and add to container
		local itemGui = script.Parent.ItemTemplate:clone()
		itemGui.Name = "Item"
		itemGui.Item.Value = item
		itemGui.ItemIcon.Image = item.IconAsset.Value
		itemGui.ItemNameLabel.Text = item.Name
		itemGui.ItemNameLabel.TextColor3 = plr.PlayerScripts.Functions.GetRarityColor:Invoke(item.Rarity.Value)
		if item.Rarity.Value == "Immortal" or item.Rarity.Value == "Developer" then
			itemGui.ItemName.TextStrokeColor3 = Color3.fromRGB(255, 255, 255)
		end
		itemGui.Position = UDim2.new(0, (entryCount % 3) * 116 + 10, 0, math.floor(entryCount / 3) * 40 + 10)
		itemGui.Parent = script.Parent
		itemGui.Visible = true
		itemGui.InteractionHandler.Disabled = false

		-- Tell preview to refresh
		plr.PlayerGui.MainGui.Crafting.MainFrame.Preview.Refresh:Fire(getItemTable())
		refreshOutlines()

		-- Return success
		return true

	else

		-- Increment count value
		existing.Count.Value = existing.Count.Value + 1
		existing.ItemCount.Text = "x " .. existing.Count.Value

		-- Tell preview to refresh
		plr.PlayerGui.MainGui.Crafting.MainFrame.Preview.Refresh:Fire(getItemTable())

		-- Return success
		return true

	end

end

script.Parent.RemoveItem.Event:connect(function(itemGui)

	-- Get item
	local item = itemGui.Item.Value

	-- Decrement count
	itemGui.Count.Value = itemGui.Count.Value - 1

	-- Check if none left
	if itemGui.Count.Value <= 0 then

		-- Calculate gui rank to be used below
		local thisRank = (((itemGui.Position.Y.Offset - 10) / 40) * 3) + ((itemGui.Position.X.Offset - 10) / 116)

		-- Destroy the gui
		itemGui:destroy()

		-- Move each item over/up
		for _, i in pairs(script.Parent:GetChildren()) do
			if i.Name == "Item" then
				local rank = (((i.Position.Y.Offset - 10) / 40) * 3) + ((i.Position.X.Offset - 10) / 116)
				if rank > thisRank then
					i.Position = i.Position + UDim2.new(0, -116, 0, 0)
					if i.Position.X.Offset < 0 then
						i.Position = i.Position + UDim2.new(0, 348, 0, -40)
					end
				end
			end
		end

	elseif itemGui.Count.Value > 1 then

		-- Change text
		itemGui.ItemCount.Text = "x " .. itemGui.Count.Value

	else

		-- Change text
		itemGui.ItemCount.Text = ""

	end

	-- Add back to main display
	plr.PlayerGui.MainGui.Crafting.MainFrame.Display.Container.AddItem:Fire(item)

	-- Tell preview to refresh
	plr.PlayerGui.MainGui.Crafting.MainFrame.Preview.Refresh:Fire(getItemTable())
	refreshOutlines()

end)

script.Parent.ClearItems.Event:connect(function()

	-- Destroy all items
	for _, i in pairs(script.Parent:GetChildren()) do
		if i.Name == "Item" then
			i:destroy()
		end
	end

	-- Tell preview to refresh
	plr.PlayerGui.MainGui.Crafting.MainFrame.Preview.Refresh:Fire({})

end)


Prompt: --- Cleans up tracking resources.

Response:
function ScopeHUD:willUnmount()
    self.Maid:Destroy()
end

function ScopeHUD:render()
    return new('Frame', {
        Active = true;
        Draggable = true;
        Position = self.state.IsToolModeEnabled and
            UDim2.new(0, 10/2, 1, -8/2) or
            UDim2.new(0, 10/2, 0, 8/2);
        AnchorPoint = self.state.IsToolModeEnabled and
            Vector2.new(0, 1) or
            Vector2.new(0, 0);
        Size = self.ContainerSize;
        BackgroundTransparency = 1;
        [Roact.Event.InputBegan] = self.OnInputBegin;
        [Roact.Event.InputEnded] = self.OnInputEnd;
    },
    Support.Merge(self:BuildScopeHierarchyButtons(), {
        Layout = new('UIListLayout', {
            [Roact.Ref] = self.LayoutRef;
            FillDirection = Enum.FillDirection.Horizontal;
            HorizontalAlignment = Enum.HorizontalAlignment.Left;
            VerticalAlignment = Enum.VerticalAlignment.Center;
            SortOrder = Enum.SortOrder.LayoutOrder;
            Padding = UDim.new(0, 5/2);
        });
        ModeToggle = new(ModeToggle, {
            Core = self.props.Core;
            IsToolModeEnabled = self.state.IsToolModeEnabled;
        });
    }))
end


Prompt: -- Gradually regenerates the Humanoid's Health over time.

Response:
local REGEN_RATE = 1 / 100 -- Regenerate this fraction of MaxHealth per second.
local REGEN_STEP = 5 -- Wait this long between each regeneration step.


Prompt: -- functions

Response:
function stopAllAnimations()
	local oldAnim = currentAnim

	-- return to idle if finishing an emote
	if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
		oldAnim = "idle"
	end

	if currentlyPlayingEmote then
		oldAnim = "idle"
		currentlyPlayingEmote = false
	end

	currentAnim = ""
	currentAnimInstance = nil
	if (currentAnimKeyframeHandler ~= nil) then
		currentAnimKeyframeHandler:disconnect()
	end

	if (currentAnimTrack ~= nil) then
		currentAnimTrack:Stop()
		currentAnimTrack:Destroy()
		currentAnimTrack = nil
	end

	for _,v in pairs(locomotionMap) do
		if v.track then
			v.track:Stop()
			v.track:Destroy()
			v.track = nil
		end
	end

	return oldAnim
end

local function getRigScale()
	if userAnimateScaleRun then
		return Character:GetScale()
	else
		return 1
	end
end

function getHeightScale()
	if Humanoid then
		if not Humanoid.AutomaticScalingEnabled then
			-- When auto scaling is not enabled, the rig scale stands in for
			-- a computed scale.
			return getRigScale()
		end

		local scale = Humanoid.HipHeight / HumanoidHipHeight
		if AnimationSpeedDampeningObject == nil then
			AnimationSpeedDampeningObject = script:FindFirstChild("ScaleDampeningPercent")
		end
		if AnimationSpeedDampeningObject ~= nil then
			scale = 1 + (Humanoid.HipHeight - HumanoidHipHeight) * AnimationSpeedDampeningObject.Value / HumanoidHipHeight
		end
		return scale
	end
	return getRigScale()
end

local function signedAngle(a, b)
	return -math.atan2(a.x * b.y - a.y * b.x, a.x * b.x + a.y * b.y)
end

local angleWeight = 2.0
local function get2DWeight(px, p1, p2, sx, s1, s2)
	local avgLength = 0.5 * (s1 + s2)

	local p_1 = {x = (sx - s1)/avgLength, y = (angleWeight * signedAngle(p1, px))}
	local p12 = {x = (s2 - s1)/avgLength, y = (angleWeight * signedAngle(p1, p2))}
	local denom = smallButNotZero + (p12.x*p12.x + p12.y*p12.y)
	local numer = p_1.x * p12.x + p_1.y * p12.y
	local r = math.clamp(1.0 - numer/denom, 0.0, 1.0)
	return r
end

local function blend2D(targetVelo, targetSpeed)
	if userAnimateScaleRun then
		local heightScale = getHeightScale()
		targetVelo /= heightScale
		targetSpeed /= heightScale
	end

	local h = {}
	local sum = 0.0
	for n,v1 in pairs(locomotionMap) do
		if targetVelo.x * v1.lv.x < 0.0 or targetVelo.y * v1.lv.y < 0 then
			-- Require same quadrant as target
			h[n] = 0.0
			continue
		end
		h[n] = math.huge
		for j,v2 in pairs(locomotionMap) do
			if targetVelo.x * v2.lv.x < 0.0 or targetVelo.y * v2.lv.y < 0 then
				-- Require same quadrant as target
				continue
			end
			h[n] = math.min(h[n], get2DWeight(targetVelo, v1.lv, v2.lv, targetSpeed, v1.speed, v2.speed))
		end
		sum += h[n]
	end

	--truncates below 10% contribution
	local sum2 = 0.0
	local weightedVeloX = 0
	local weightedVeloY = 0
	for n,v in pairs(locomotionMap) do

		if (h[n] / sum > 0.1) then
			sum2 += h[n]
			weightedVeloX += h[n] * v.lv.x
			weightedVeloY += h[n] * v.lv.y
		else
			h[n] = 0.0
		end
	end
	local animSpeed
	local weightedSpeedSquared = weightedVeloX * weightedVeloX + weightedVeloY * weightedVeloY
	if weightedSpeedSquared > smallButNotZero then
		animSpeed = math.sqrt(targetSpeed * targetSpeed / weightedSpeedSquared)
	else
		animSpeed = 0
	end

	if not userAnimateScaleRun then
		animSpeed = animSpeed / getHeightScale()
	end
	local groupTimePosition = 0
	for n,v in pairs(locomotionMap) do
		if v.track.IsPlaying then
			groupTimePosition = v.track.TimePosition
			break
		end
	end
	for n,v in pairs(locomotionMap) do
		-- if not loco
		if h[n] > 0.0 then
			if not v.track.IsPlaying then
				v.track:Play(runBlendtime)
				v.track.TimePosition = groupTimePosition
			end

			local weight = math.max(smallButNotZero, h[n] / sum2)
			v.track:AdjustWeight(weight, runBlendtime)
			v.track:AdjustSpeed(animSpeed)
		else
			v.track:Stop(runBlendtime)
		end
	end

end

local function getWalkDirection()
	local walkToPoint = Humanoid.WalkToPoint
	local walkToPart = Humanoid.WalkToPart
	if Humanoid.MoveDirection ~= Vector3.zero then
		return Humanoid.MoveDirection
	elseif walkToPart or walkToPoint ~= Vector3.zero then
		local destination
		if walkToPart then
			destination = walkToPart.CFrame:PointToWorldSpace(walkToPoint)
		else
			destination = walkToPoint
		end
		local moveVector = Vector3.zero
		if Humanoid.RootPart then
			moveVector = destination - Humanoid.RootPart.CFrame.Position
			moveVector = Vector3.new(moveVector.x, 0.0, moveVector.z)
			local mag = moveVector.Magnitude
			if mag > 0.01 then
				moveVector /= mag
			end
		end
		return moveVector
	else
		return Humanoid.MoveDirection
	end
end

local function updateVelocity(currentTime)

	local tempDir

	if locomotionMap == strafingLocomotionMap then

		local moveDirection = getWalkDirection()

		if not Humanoid.RootPart then
			return
		end

		local cframe = Humanoid.RootPart.CFrame
		if math.abs(cframe.UpVector.Y) < smallButNotZero or pose ~= "Running" or humanoidSpeed < 0.001 then
			-- We are horizontal!  Do something  (turn off locomotion)
			for n,v in pairs(locomotionMap) do
				if v.track then
					v.track:AdjustWeight(smallButNotZero, runBlendtime)
				end
			end
			return
		end
		local lookat = cframe.LookVector
		local direction = Vector3.new(lookat.X, 0.0, lookat.Z)
		direction = direction / direction.Magnitude --sensible upVector means this is non-zero.
		local ly = moveDirection:Dot(direction)
		if ly <= 0.0 and ly > -0.05 then
			ly = smallButNotZero -- break quadrant ties in favor of forward-friendly strafes
		end
		local lx = direction.X*moveDirection.Z - direction.Z*moveDirection.X
		local tempDir = Vector2.new(lx, ly) -- root space moveDirection
		local delta = Vector2.new(tempDir.x-cachedLocalDirection.x, tempDir.y-cachedLocalDirection.y)
		-- Time check serves the purpose of the old keyframeReached sync check, as it syncs anim timePosition
		if delta:Dot(delta) > 0.001 or math.abs(humanoidSpeed - cachedRunningSpeed) > 0.01 or currentTime - lastBlendTime > 1 then
			cachedLocalDirection = tempDir
			cachedRunningSpeed = humanoidSpeed
			lastBlendTime = currentTime
			blend2D(cachedLocalDirection, cachedRunningSpeed)
		end
	else
		if math.abs(humanoidSpeed - cachedRunningSpeed) > 0.01 or currentTime - lastBlendTime > 1 then
			cachedRunningSpeed = humanoidSpeed
			lastBlendTime = currentTime
			blend2D(Vector2.yAxis, cachedRunningSpeed)
		end
	end
end

function setAnimationSpeed(speed)
	if currentAnim ~= "walk" then
		if speed ~= currentAnimSpeed then
			currentAnimSpeed = speed
			currentAnimTrack:AdjustSpeed(currentAnimSpeed)
		end
	end
end

function keyFrameReachedFunc(frameName)
	if (frameName == "End") then
		local repeatAnim = currentAnim
		-- return to idle if finishing an emote
		if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then
			repeatAnim = "idle"
		end

		if currentlyPlayingEmote then
			if currentAnimTrack.Looped then
				-- Allow the emote to loop
				return
			end

			repeatAnim = "idle"
			currentlyPlayingEmote = false
		end

		local animSpeed = currentAnimSpeed
		playAnimation(repeatAnim, 0.15, Humanoid)
		setAnimationSpeed(animSpeed)
	end
end

function rollAnimation(animName)
	local roll = math.random(1, animTable[animName].totalWeight)
	local origRoll = roll
	local idx = 1
	while (roll > animTable[animName][idx].weight) do
		roll = roll - animTable[animName][idx].weight
		idx = idx + 1
	end
	return idx
end

local function switchToAnim(anim, animName, transitionTime, humanoid)
	-- switch animation
	if (anim ~= currentAnimInstance) then

		if (currentAnimTrack ~= nil) then
			currentAnimTrack:Stop(transitionTime)
			currentAnimTrack:Destroy()
		end
		if (currentAnimKeyframeHandler ~= nil) then
			currentAnimKeyframeHandler:disconnect()
		end

		currentAnimSpeed = 1.0

		currentAnim = animName
		currentAnimInstance = anim	-- nil in the case of locomotion

		if animName == "walk" then
			setupWalkAnimations()
		else
			destroyWalkAnimations()
			-- load it to the humanoid; get AnimationTrack
			currentAnimTrack = humanoid:LoadAnimation(anim)
			currentAnimTrack.Priority = Enum.AnimationPriority.Core

			currentAnimTrack:Play(transitionTime)

			-- set up keyframe name triggers
			currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
		end
	end
end

function playAnimation(animName, transitionTime, humanoid)
	local idx = rollAnimation(animName)
	local anim = animTable[animName][idx].anim

	switchToAnim(anim, animName, transitionTime, humanoid)
	currentlyPlayingEmote = false
end

function playEmote(emoteAnim, transitionTime, humanoid)
	switchToAnim(emoteAnim, emoteAnim.Name, transitionTime, humanoid)
	currentlyPlayingEmote = true
end


Prompt: -- подготовка массива моделей участков

Response:
for a,b in pairs (tmp) do
	if b.ClassName == "Model" then -- проверить дочек на модель
		table.insert(models,b:Clone())	-- добавляем клон в массив моделей
		b:Destroy()						-- удаляем оригинал
	end
end


Prompt:
--
--inputS.TouchStarted:Connect(function(object)
--	if object == Enum.KeyCode.DPadUp or seat.Throttle == 1 then
--		w=true
--	elseif object == Enum.KeyCode.DPadLeft or seat.Steer == -1 then
--		a=true
--	elseif object == Enum.KeyCode.DPadDown or seat.Throttle == -1 then
--		s=true
--	elseif object == Enum.KeyCode.DPadRight or seat.Steer == 1 then
--		d=true
--	end
--end)

Response:
inputS.InputEnded:connect(function(input)
	local code=input.KeyCode
	if code==Enum.KeyCode.LeftShift then
		up=false
	elseif input.KeyCode==Enum.KeyCode.LeftControl then
		dn=false
	end
end)


Prompt: -- Color shortcuts: you can use these strings instead of full property names

Response:
local propertyShortcuts = {}
propertyShortcuts.Color = "TextColor3"
propertyShortcuts.StrokeColor = "TextStrokeColor3"
propertyShortcuts.ImageColor = "ImageColor3"


Prompt: -- << VARIABLES >>

Response:
local topBar = main.gui.CustomTopBar
local coreToHide = {"Chat", "PlayerList"}
local originalCoreStates = {};
local cmdBar = main.gui.CmdBar
local isOpen = false
local currentProps = {}
local originalTopBarTransparency = 1
local originalTopBarVisibility = true
local mainProps
mainProps = {
	maxSuggestions = 5;
	mainParent = cmdBar;
	textBox = cmdBar.SearchFrame.TextBox;
	rframe = cmdBar.ResultsFrame;
	suggestionPos = 1;
	suggestionDisplayed = 0;
	forceExecute = false;
	highlightColor = Color3.fromRGB(50,50,50);
	otherColor = Color3.fromRGB(80,80,80);
	suggestionLabels = {};
	currentBarCommand = nil;
}


Response:
event.OnClientEvent:Connect(function(msg, color)
	channels.RBXGeneral:DisplaySystemMessage(msg)--, color)
end)


Prompt: -- Decompiled with the Synapse X Luau decompiler.

Response:
local l__Players__1 = game:GetService("Players");
local u1 = {
	Climbing = {
		SoundId = "rbxasset://sounds/action_footsteps_plastic.mp3",
		Looped = true
	},
	Died = {
		SoundId = "rbxasset://sounds/uuhhh.mp3"
	},
	FreeFalling = {
		SoundId = "rbxasset://sounds/action_falling.mp3",
		Looped = true
	},
	GettingUp = {
		SoundId = "rbxasset://sounds/action_get_up.mp3"
	},
	Jumping = {
		SoundId = "rbxasset://sounds/action_jump.mp3"
	},
	Landing = {
		SoundId = "rbxasset://sounds/action_jump_land.mp3"
	},
	Running = {
		SoundId = "rbxasset://sounds/action_footsteps_plastic.mp3",
		Looped = true,
		Pitch = 1.85
	},
	Splash = {
		SoundId = "rbxasset://sounds/impact_water.mp3"
	},
	Swimming = {
		SoundId = "rbxasset://sounds/action_swim.mp3",
		Looped = true,
		Pitch = 1.6
	}
};
local function u2(p1)
	local v2 = {};
	for v3, v4 in pairs(p1) do
		v2[v3] = v4;
	end;
	return v2;
end;
local function u3(p2)
	p2.TimePosition = 0;
	p2.Playing = true;
end;
local function u4(p3, p4, p5, p6, p7)
	return (p3 - p4) * (p7 - p6) / (p5 - p4) + p6;
end;
local l__RunService__5 = game:GetService("RunService");
local function u6(...)
	local u7 = { ... };
	local u8 = Instance.new("BindableEvent");
	local function v5(...)
		for v6 = 1, #u7 do
			u7[v6]:Disconnect();
		end;
		return u8:Fire(...);
	end;
	for v7 = 1, #u7 do
		u7[v7] = u7[v7]:Connect(v5);
	end;
	return u8.Event:Wait();
end;
local function u9(p8, p9, p10)
	local v8 = {};
	for v9, v10 in pairs(u1) do
		local v11 = Instance.new("Sound");
		v11.Name = v9;
		v11.Archivable = false;
		v11.EmitterSize = 5;
		v11.MaxDistance = 150;
		v11.Volume = 0.65;
		for v12, v13 in pairs(v10) do
			v11[v12] = v13;
		end;
		v11.Parent = p10;
		v8[v9] = v11;
	end;
	local u10 = {};
	local v14 = {};
	local function u11(p11)
		for v15, v16 in pairs(u2(u10)) do
			if v15 ~= p11 then
				v15.Playing = false;
				u10[v15] = nil;
			end;
		end;
	end;
	v14[Enum.HumanoidStateType.FallingDown] = function()
		u11();
	end;
	v14[Enum.HumanoidStateType.GettingUp] = function()
		u11();
		u3(v8.GettingUp);
	end;
	v14[Enum.HumanoidStateType.Jumping] = function()
		u11();
		u3(v8.Jumping);
	end;
	v14[Enum.HumanoidStateType.Swimming] = function()
		local v17 = math.abs(p10.Velocity.Y);
		if v17 > 0.1 then
			v8.Splash.Volume = math.clamp(u4(v17, 100, 350, 0.28, 1), 0, 1);
			u3(v8.Splash);
		end;
		u11(v8.Swimming);
		v8.Swimming.Playing = true;
		u10[v8.Swimming] = true;
	end;
	v14[Enum.HumanoidStateType.Freefall] = function()
		v8.FreeFalling.Volume = 0;
		u11(v8.FreeFalling);
		u10[v8.FreeFalling] = true;
	end;
	v14[Enum.HumanoidStateType.Landed] = function()
		u11();
		local v18 = math.abs(p10.Velocity.Y);
		if v18 > 75 then
			v8.Landing.Volume = math.clamp(u4(v18, 50, 100, 0, 1), 0, 1);
			u3(v8.Landing);
		end;
	end;
	v14[Enum.HumanoidStateType.Running] = function()
		u11(v8.Running);
		v8.Running.Playing = true;
		u10[v8.Running] = true;
	end;
	v14[Enum.HumanoidStateType.Climbing] = function()
		local l__Climbing__19 = v8.Climbing;
		if math.abs(p10.Velocity.Y) > 0.1 then
			l__Climbing__19.Playing = true;
			u11(l__Climbing__19);
		else
			u11();
		end;
		u10[l__Climbing__19] = true;
	end;
	v14[Enum.HumanoidStateType.Seated] = function()
		u11();
	end;
	v14[Enum.HumanoidStateType.Dead] = function()
		u11();
		u3(v8.Died);
	end;
	local v20 = {
		[v8.Climbing] = function(p12, p13, p14)
			p13.Playing = p14.Magnitude > 0.1;
		end,
		[v8.FreeFalling] = function(p15, p16, p17)
			if not (p17.Magnitude > 75) then
				p16.Volume = 0;
				return;
			end;
			p16.Volume = math.clamp(p16.Volume + 0.9 * p15, 0, 1);
		end
	};
	v20[v8.Running] = function(p18, p19, p20)
		local v21 = false;
		if p20.Magnitude > 0.5 then
			v21 = p9.MoveDirection.Magnitude > 0.5;
		end;
		p19.Playing = v21;
	end;
	local v22 = {
		[Enum.HumanoidStateType.RunningNoPhysics] = Enum.HumanoidStateType.Running
	};
	local u12 = v22[p9:GetState()] or p9:GetState();
	local u13 = p9.StateChanged:Connect(function(p21, p22)
		p22 = v22[p22] and p22;
		if p22 ~= u12 then
			local v23 = v14[p22];
			if v23 then
				v23();
			end;
			u12 = p22;
		end;
	end);
	local u14 = l__RunService__5.Stepped:Connect(function(p23, p24)
		for v24, v25 in pairs(u10) do
			local v26 = v20[v24];
			if v26 then
				v26(p24, v24, p10.Velocity);
			end;
		end;
	end);
	local u15 = nil;
	local u16 = nil;
	local u17 = nil;
	local function u18()
		u13:Disconnect();
		u14:Disconnect();
		u15:Disconnect();
		u16:Disconnect();
		u17:Disconnect();
	end;
	u15 = p9.AncestryChanged:Connect(function(p25, p26)
		if not p26 then
			u18();
		end;
	end);
	u16 = p10.AncestryChanged:Connect(function(p27, p28)
		if not p28 then
			u18();
		end;
	end);
	u17 = p8.CharacterAdded:Connect(u18);
end;
local function v27(p29)
	local function v28(p30)
		if not p30.Parent then
			u6(p30.AncestryChanged, p29.CharacterAdded);
		end;
		if p29.Character ~= p30 or not p30.Parent then
			return;
		end;
		local v29 = p30:FindFirstChildOfClass("Humanoid");
		while p30:IsDescendantOf(game) and not v29 do
			u6(p30.ChildAdded, p30.AncestryChanged, p29.CharacterAdded);
			v29 = p30:FindFirstChildOfClass("Humanoid");
		end;
		if p29.Character ~= p30 or not p30:IsDescendantOf(game) then
			return;
		end;
		local v30 = p30:FindFirstChild("HumanoidRootPart");
		while p30:IsDescendantOf(game) and not v30 do
			u6(p30.ChildAdded, p30.AncestryChanged, v29.AncestryChanged, p29.CharacterAdded);
			v30 = p30:FindFirstChild("HumanoidRootPart");
		end;
		if v30 and v29:IsDescendantOf(game) and p30:IsDescendantOf(game) and p29.Character == p30 then
			u9(p29, v29, v30);
		end;
	end;
	if p29.Character then
		v28(p29.Character);
	end;
	p29.CharacterAdded:Connect(v28);
end;
l__Players__1.PlayerAdded:Connect(v27);
for v31, v32 in ipairs(l__Players__1:GetPlayers()) do
	v27(v32);
end;


Prompt:
--- Add a task to clean up
-- @usage
-- Maid[key] = (function)         Adds a task to perform
-- Maid[key] = (event connection) Manages an event connection
-- Maid[key] = (thread)           Manages a thread
-- Maid[key] = (Maid)             Maids can act as an event connection, allowing a Maid to have other maids to clean up.
-- Maid[key] = (Object)           Maids can cleanup objects with a `Destroy` method
-- Maid[key] = nil                Removes a named task. If the task is an event, it is disconnected. If it is an object,
--                                it is destroyed.

Response:
function Maid:__newindex(index, newTask)
	if Maid[index] ~= nil then
		error(("Cannot use '%s' as a Maid key"):format(tostring(index)), 2)
	end

	local tasks = self._tasks
	local oldTask = tasks[index]

	if oldTask == newTask then
        	return
	end

	tasks[index] = newTask

	if oldTask then
		if type(oldTask) == "function" then
			oldTask()
		elseif type(oldTask) == "thread" then
			local cancelled
			if coroutine.running() ~= oldTask then
				cancelled = pcall(function()
					task.cancel(oldTask)
				end)
			end

			if not cancelled then
				task.defer(function()
					task.cancel(oldTask)
				end)
			end
		elseif typeof(oldTask) == "RBXScriptConnection" then
			oldTask:Disconnect()
		elseif oldTask.Destroy then
			oldTask:Destroy()
		end
	end
end


Prompt: -- 1 == if two players vote yes, and two players vote no, the player gets kicked

Response:
conf.MinimumVotesRequired = 2 -- This is recommended to be at 2 to prevent a player from kicking the second player in the server

conf.PlayerVoteKickCooldown = 120 -- How long between a single player being able to start a vote kick
conf.VoteKickCooldown = 30 -- How long between all vote kicks
conf.KickTime = 15 -- How much time is given to vote kick

return conf


Prompt:
--[[
	Updates all Tween objects.
]]

Response:
local function updateAllTweens()
	local now = os.clock()
	-- FIXME: Typed Luau doesn't understand this loop yet
	for tween in allTweens :: any do
		local currentTime = now - tween._currentTweenStartTime

		if currentTime > tween._currentTweenDuration then
			if tween._currentTweenInfo.Reverses then
				tween._currentValue = tween._prevValue
			else
				tween._currentValue = tween._nextValue
			end
			tween._currentlyAnimating = false
			updateAll(tween)
			TweenScheduler.remove(tween)
		else
			local ratio = getTweenRatio(tween._currentTweenInfo, currentTime)
			local currentValue = lerpType(tween._prevValue, tween._nextValue, ratio)
			tween._currentValue = currentValue
			tween._currentlyAnimating = true
			updateAll(tween)
		end
	end
end

RunService:BindToRenderStep(
	"__FusionTweenScheduler",
	Enum.RenderPriority.First.Value,
	updateAllTweens
)

return TweenScheduler


Prompt: --Declared variables

Response: local hum = script.Parent:WaitForChild("Humanoid")


Prompt: --// Processing

Response:
return function()
	local _G, game, script, getfenv, setfenv, workspace,
		getmetatable, setmetatable, loadstring, coroutine,
		rawequal, typeof, print, math, warn, error,  pcall,
		xpcall, select, rawset, rawget, ipairs, pairs,
		next, Rect, Axes, os, tick, Faces, unpack, string, Color3,
		newproxy, tostring, tonumber, Instance, TweenInfo, BrickColor,
		NumberRange, ColorSequence, NumberSequence, ColorSequenceKeypoint,
		NumberSequenceKeypoint, PhysicalProperties, Region3int16,
		Vector3int16, elapsedTime, require, table, type, wait,
		Enum, UDim, UDim2, Vector2, Vector3, Region3, CFrame, Ray, delay =
		_G, game, script, getfenv, setfenv, workspace,
		getmetatable, setmetatable, loadstring, coroutine,
		rawequal, typeof, print, math, warn, error,  pcall,
		xpcall, select, rawset, rawget, ipairs, pairs,
		next, Rect, Axes, os, tick, Faces, unpack, string, Color3,
		newproxy, tostring, tonumber, Instance, TweenInfo, BrickColor,
		NumberRange, ColorSequence, NumberSequence, ColorSequenceKeypoint,
		NumberSequenceKeypoint, PhysicalProperties, Region3int16,
		Vector3int16, elapsedTime, require, table, type, wait,
		Enum, UDim, UDim2, Vector2, Vector3, Region3, CFrame, Ray, delay

	local script = script
	local service = service
	local client = client
	local Anti, Core, Functions, Process, Remote, UI, Variables, Deps
	local function Init()
		UI = client.UI;
		Anti = client.Anti;
		Core = client.Core;
		Variables = client.Variables
		Functions = client.Functions;
		Process = client.Process;
		Remote = client.Remote;
		Deps = client.Deps;
	end

	getfenv().client = nil
	getfenv().service = nil
	getfenv().script = nil

	client.UI = {
		Init = Init;
		GetHolder = function()
			if UI.Holder and UI.Holder.Parent == service.PlayerGui then
				return UI.Holder
			else
				pcall(function()if UI.Holder then UI.Holder:Destroy()end end)
				local new = service.New("ScreenGui");
				new.Name = Functions.GetRandom()
				new.Parent = service.PlayerGui
				UI.Holder = new
				return UI.Holder
			end
		end;

		Prepare = function(gui)
			if true then return gui end	--// Disabled

			local gTable = UI.Get(gui,false,true)
			if gui:IsA("ScreenGui") or gui:IsA("GuiMain") then
				local new = Instance.new("TextLabel")
				new.BackgroundTransparency = 1
				new.Size = UDim2.new(1,0,1,0)
				new.Name = gui.Name
				new.Active = true
				new.Text = ""

				for ind,child in next,gui:GetChildren()do
					child.Parent = new
				end

				if gTable then
					gTable:Register(new)
				end

				gui:Destroy()

				return new
			else
				return gui
			end
		end;

		LoadModule = function(module, data, env)
			local ran,func = pcall(require, module)
			local newEnv = GetEnv(env)
			local data = data or {}

			newEnv.script = module
			newEnv.client = service.CloneTable(client)
			newEnv.service = service.CloneTable(service)
			newEnv.service.Threads = service.CloneTable(service.Threads)

			for i,v in next,newEnv.client do
				if type(v) == "table" and i ~= "Variables" and i ~= "Handlers" then
					newEnv.client[i] = service.CloneTable(v)
				end
			end

			if ran then
				local rets = {service.TrackTask("UI: ".. module:GetFullName(), setfenv(func,newEnv), data)}
				local ran = rets[1]
				if ran then
					return unpack(rets,2)
				else
					warn("Error while running module "..module.Name,tostring(rets[2]))
					client.LogError("Error loading "..tostring(module).." - "..tostring(rets[2]))
				end
			else
				warn("Error while loading module "..module.Name,tostring(func))
			end
		end;

		GetNew = function(theme, name)
			local found = {}
			local endConfig = {}
			local endConfValues = {}
			local confFolder = Instance.new("Folder")
			local func

			function func(theme, name, depth)
				local depth = (depth or 11) - 1
				local folder = Deps.UI:FindFirstChild(theme) or Deps.UI.Default
				if folder then
					local baseValue = folder:FindFirstChild("Base_Theme")
					local baseTheme = baseValue and baseValue.Value
					local foundGUI = (baseValue and folder:FindFirstChild(name)) or Deps.UI.Default:FindFirstChild(name)

					if foundGUI then
						local config = foundGUI:FindFirstChild("Config")
						table.insert(found, {
							Theme = theme;
							Folder = folder;
							Name = name;
							Found = foundGUI;
							Config = config;
							isModule = foundGUI:IsA("ModuleScript");
						})

						if config then
							baseValue = config:FindFirstChild("BaseTheme") or baseValue
							baseTheme = baseValue and baseValue.Value
						end
					end

					if baseTheme and depth > 0 then
						func(baseTheme, name, depth)
					end
				end
			end

			--// Find GUI and all default versions under it
			func(theme, name)
			confFolder.Name = "Config"

			if #found > 0 then

				--// Combine all configs found in order  to build full config (in order of closest from target gui to furthest)
				for i,v in next,found do
					if v.Config then
						for k,m in next,v.Config:GetChildren() do
							if not endConfig[m.Name] then
								endConfig[m.Name] = m
							end
						end
					end
				end

				--// Load all config values into the new Config folder
				for i,v in next,endConfig do
					v:Clone().Parent = confFolder
				end

				--// Find next module based theme GUI if code not found or first in sequence is module (in theme)
				if found[1].isModule then
					return found[1].Found, found[1].Folder, confFolder
				elseif not endConfig.Code then
					for i,v in next,found do
						if v.isModule then
							return v.Found, v.Folder, confFolder
						end
					end
				end

				--// Get rid of an old Config folder and throw the new combination Config folder in
				local new = found[1].Found:Clone()
				local oldFolder = new:FindFirstChild'Config'

				if oldFolder then oldFolder:Destroy() end

				confFolder.Parent = new

				return new, found[1].Folder, confFolder
			end
		end;

		Make = function(name, data, themeData)
			local data = data or {}
			local defaults = {Desktop = "Default"; Mobile = "Mobilius"}
			local themeData = themeData or Variables.LastServerTheme or defaults
			local theme = Variables.CustomTheme or (service.IsMobile() and themeData.Mobile) or themeData.Desktop
			local folder = Deps.UI:FindFirstChild(theme) or Deps.UI.Default
			local newGui, folder2, foundConf = UI.GetNew(theme, name)

			if newGui then
				local isModule = newGui:IsA("ModuleScript")
				local conf = newGui:FindFirstChild("Config")
				local mod = conf and conf:FindFirstChild("Modifier")

				if isModule then
					return UI.LoadModule(newGui, data, {
						script = newGui;
					})
				elseif conf and foundConf and foundConf ~= true then
					local code = foundConf.Code
					local mult = foundConf.AllowMultiple
					local keep = foundConf.CanKeepAlive

					local allowMult = mult and mult.Value or true
					local found, num = UI.Get(name)

					if not found or ((num and num>0) and allowMult) then
						local gTable,gIndex = UI.Register(newGui)
						local newEnv = {}

						if folder:IsA("ModuleScript") then
							newEnv.script = folder
							newEnv.gTable = gTable
							local ran,func = pcall(require, folder)
							local newEnv = GetEnv(newEnv)
							local rets = {pcall(setfenv(func,newEnv),newGui, gTable, data)}
							local ran = rets[1]
							local ret = rets[2]

							if ret ~= nil then
								if type(ret) == "userdata" and Anti.GetClassName(ret) == "ScreenGui" then
									code = (ret:FindFirstChild("Config") and ret.Config:FindFirstChild("Code")) or code
								else
									return ret
								end
							end
						end

						newGui.Parent = Variables.GUIHolder
						newGui.Name = Functions.GetRandom()

						data.gIndex = gIndex
						data.gTable = gTable

						code.Parent = conf
						code.Name = name

						if mod then
							UI.LoadModule(mod, data, {
								script = mod;
								gTable = gTable;
								Data = data;
								GUI = newGui;
							})
						end

						return UI.LoadModule(code, data, {
							script = code;
							gTable = gTable;
							Data = data;
							GUI = newGui;
						})
					end
				end
			else
				print("GUI "..tostring(name).." not found")
			end
		end;

		Get = function(obj,ignore,returnOne)
			local found = {}
			local num = 0
			if obj then
				for ind,g in next,client.GUIs do
					if g.Name ~= ignore and g.Object ~= ignore and g ~= ignore then
						if type(obj) == "string" then
							if g.Name == obj then
								found[ind] = g
								num = num+1
								if returnOne then return g end
							end
						elseif type(obj) == "userdata" then
							if service.RawEqual(g.Object, obj) then
								found[ind] = g
								num = num+1
								if returnOne then return g end
							end
						elseif type(obj) == "boolean" and obj == true then
							found[ind] = g
							num = num+1
							if returnOne then return g end
						end
					end
				end
			end
			if num<1 then
				return false
			else
				return found,num
			end
		end;

		Remove = function(name, ignore)
			local gui = UI.Get(name, ignore)
			if gui then
				for i,v in next,gui do
					v.Destroy()
				end
			end
		end;

		Register = function(gui, data)
			local gIndex = Functions.GetRandom()
			local gTable;gTable = {
				Object = gui,
				Config = gui:FindFirstChild'Config';
				Name = gui.Name,
				Events = {},
				Class = gui.ClassName,
				Index = gIndex,
				Active = true,
				Ready = function()
					if gTable.Config then gTable.Config.Parent = nil end
					if pcall(function()
						if gTable.Class == "ScreenGui" or gTable.Class == "GuiMain" then
							gTable.Object.Parent = service.PlayerGui
						else
							gTable.Object.Parent = UI.GetHolder()
						end
					end) then
						gTable.Active = true
					else
						warn("Something happened while trying to set the parent of "..tostring(gTable.Name))
						warn'Maybe it was locked (Destroyed)?'
						gTable:Destroy()
					end
				end,
				BindEvent = function(event, func)
					local signal = event:connect(func)
					local origDisc = signal.Disconnect
					local Events = gTable.Events
					local disc = function()
						origDisc(signal)
						for i,v in next, Events do
							if v.Signal == signal then
								table.remove(Events, i)
							end
						end
					end

					table.insert(Events, {
						Signal = signal;
						Remove = disc
					})

					return {
						Disconnect = disc;
						disconnect = disc;
						wait = service.CheckProperty(signal, "wait") and signal.wait
					}, signal
				end,
				ClearEvents = function()
					for i,v in next,gTable.Events do
						v:Remove()
					end
				end,
				Destroy = function()
					pcall(function()
						if gTable.CustomDestroy then
							gTable.CustomDestroy()
						else
							service.UnWrap(gTable.Object):Destroy()
						end
					end)
					gTable.Destroyed = true
					gTable.Active = false
					client.GUIs[gIndex] = nil
					gTable.ClearEvents()
				end,
				UnRegister = function()
					client.GUIs[gIndex] = nil
					if gTable.AncestryEvent then
						gTable.AncestryEvent:Disconnect()
					end
				end,
				Register = function(tab,new)
					if not new then new=tab end

					new:SetSpecial("Destroy", gTable.Destroy)
					gTable.Object = service.Wrap(new)
					gTable.Class = new.ClassName

					if gTable.AncestryEvent then
						gTable.AncestryEvent:Disconnect()
					end

					gTable.AncestryEvent = new.AncestryChanged:Connect(function(c, parent)
						if client.GUIs[gIndex] then
							if rawequal(c, gTable.Object) and gTable.Class == "TextLabel" and parent == service.PlayerGui then
								wait()
								gTable.Object.Parent = UI.GetHolder()
							elseif rawequal(c, gTable.Object) and parent == nil and not gTable.KeepAlive then
								gTable:Destroy()
							elseif rawequal(c, gTable.Object) and parent ~= nil then
								gTable.Active = true
								client.GUIs[gIndex] = gTable
							end
						end
					end)
					client.GUIs[gIndex] = gTable
				end
			}

			if data then
				for i,v in next,data do
					gTable[i] = v
				end
			end

			gui.Name = Functions.GetRandom()
			gTable:Register(gui)

			return gTable,gIndex
		end
	}

	client.UI.RegisterGui 	= client.UI.Register
	client.UI.GetGui 		= client.UI.Get
	client.UI.PrepareGui 	= client.UI.Prepare
	client.UI.MakeGui 		= client.UI.Make
end


Prompt: -- map a value from one range to another

Response:
local function map(x: number, inMin: number, inMax: number, outMin: number, outMax: number): number
	return (x - inMin)*(outMax - outMin)/(inMax - inMin) + outMin
end

local function playSound(sound: Sound)
	if sound.SoundId == "rbxassetid://1237557124" then
		sound.TimePosition = 0.35
		sound.Volume = 1
	else
		sound.TimePosition = 0
		end
	sound.Playing = true
end

local function shallowCopy(t)
	local out = {}
	for k, v in pairs(t) do
		out[k] = v
	end
	return out
end

local function initializeSoundSystem(instances)
	local player = instances.player
	local humanoid = instances.humanoid
	local rootPart = instances.rootPart

	local sounds: {[string]: Sound} = {}

	-- initialize sounds
	for name: string, props: {[string]: any} in pairs(SOUND_DATA) do
		local sound: Sound = Instance.new("Sound")
		sound.Name = name

		-- set default values
		sound.Archivable = false
		sound.RollOffMinDistance = 5
		sound.RollOffMaxDistance = 150
		sound.Volume = 0.65

		for propName, propValue: any in pairs(props) do
			(sound :: any)[propName] = propValue
		end

		sound.Parent = rootPart
		sounds[name] = sound
	end

	local playingLoopedSounds: {[Sound]: boolean?} = {}

	local function stopPlayingLoopedSounds(except: Sound?)
		for sound in pairs(shallowCopy(playingLoopedSounds)) do
			if sound ~= except then
				sound.Playing = false
				playingLoopedSounds[sound] = nil
			end
		end
	end

	-- state transition callbacks.
	local stateTransitions: {[Enum.HumanoidStateType]: () -> ()} = {
		[Enum.HumanoidStateType.FallingDown] = function()
			stopPlayingLoopedSounds()
		end,

		[Enum.HumanoidStateType.GettingUp] = function()
			stopPlayingLoopedSounds()
			playSound(sounds.GettingUp)
		end,

		[Enum.HumanoidStateType.Jumping] = function()
			stopPlayingLoopedSounds()
			playSound(sounds.Jumping)
		end,

		[Enum.HumanoidStateType.Swimming] = function()
			local verticalSpeed = math.abs(rootPart.AssemblyLinearVelocity.Y)
			if verticalSpeed > 0.1 then
				sounds.Splash.Volume = math.clamp(map(verticalSpeed, 100, 350, 0.28, 1), 0, 1)
				playSound(sounds.Splash)
			end
			stopPlayingLoopedSounds(sounds.Swimming)
			sounds.Swimming.Playing = true
			playingLoopedSounds[sounds.Swimming] = true
		end,

		[Enum.HumanoidStateType.Freefall] = function()
			sounds.FreeFalling.Volume = 0
			stopPlayingLoopedSounds(sounds.FreeFalling)
			playingLoopedSounds[sounds.FreeFalling] = true
		end,

		[Enum.HumanoidStateType.Landed] = function()
			stopPlayingLoopedSounds()
			local verticalSpeed = math.abs(rootPart.AssemblyLinearVelocity.Y)
			if verticalSpeed > 75 then
				sounds.Landing.Volume = math.clamp(map(verticalSpeed, 50, 100, 0, 1), 0, 1)
				playSound(sounds.Landing)
			end
		end,

		[Enum.HumanoidStateType.Running] = function()
			stopPlayingLoopedSounds(sounds.Running)
			sounds.Running.Playing = true
			playingLoopedSounds[sounds.Running] = true
		end,

		[Enum.HumanoidStateType.Climbing] = function()
			local sound = sounds.Climbing
			if math.abs(rootPart.AssemblyLinearVelocity.Y) > 0.1 then
				sound.Playing = true
				stopPlayingLoopedSounds(sound)
			else
				stopPlayingLoopedSounds()
			end
			playingLoopedSounds[sound] = true
		end,

		[Enum.HumanoidStateType.Seated] = function()
			stopPlayingLoopedSounds()
		end,

		[Enum.HumanoidStateType.Dead] = function()
			stopPlayingLoopedSounds()
			playSound(sounds.Died)
		end,
	}

	-- updaters for looped sounds
	local loopedSoundUpdaters: {[Sound]: (number, Sound, Vector3) -> ()} = {
		[sounds.Climbing] = function(dt: number, sound: Sound, vel: Vector3)
			sound.Playing = vel.Magnitude > 0.1
		end,

		[sounds.FreeFalling] = function(dt: number, sound: Sound, vel: Vector3): ()
			if vel.Magnitude > 75 then
				sound.Volume = math.clamp(sound.Volume + 0.9*dt, 0, 1)
			else
				sound.Volume = 0
			end
		end,

		[sounds.Running] = function(dt: number, sound: Sound, vel: Vector3)
			sound.Playing = vel.Magnitude > 0.5 and humanoid.MoveDirection.Magnitude > 0.5
		end,
	}

	-- state substitutions to avoid duplicating entries in the state table
	local stateRemap: {[Enum.HumanoidStateType]: Enum.HumanoidStateType} = {
		[Enum.HumanoidStateType.RunningNoPhysics] = Enum.HumanoidStateType.Running,
	}

	local activeState: Enum.HumanoidStateType = stateRemap[humanoid:GetState()] or humanoid:GetState()

	local function transitionTo(state)
		local transitionFunc: () -> () = stateTransitions[state]

		if transitionFunc then
			transitionFunc()
		end

		activeState = state
	end

	transitionTo(activeState)

	local stateChangedConn = humanoid.StateChanged:Connect(function(_, state)
		state = stateRemap[state] or state

		if state ~= activeState then
			transitionTo(state)
		end
	end)

	local steppedConn = RunService.Stepped:Connect(function(_, worldDt: number)
		-- update looped sounds on stepped
		for sound in pairs(playingLoopedSounds) do
			local updater: (number, Sound, Vector3) -> () = loopedSoundUpdaters[sound]

			if updater then
				updater(worldDt, sound, rootPart.AssemblyLinearVelocity)
			end
		end
	end)

	local function terminate()
		stateChangedConn:Disconnect()
		steppedConn:Disconnect()

		-- Unparent all sounds and empty sounds table
		-- This is needed in order to support the case where initializeSoundSystem might be called more than once for the same player,
		-- which might happen in case player character is unparented and parented back on server and reset-children mechanism is active.
		for name: string, sound: Sound in pairs(sounds) do
			sound:Destroy()
		end
		table.clear(sounds)
	end

	return terminate
end

local binding = AtomicBinding.new({
	humanoid = "Humanoid",
	rootPart = "HumanoidRootPart",
}, initializeSoundSystem)

local playerConnections = {}

local function characterAdded(character)
	binding:bindRoot(character)
end

local function characterRemoving(character)
	binding:unbindRoot(character)
end

local function playerAdded(player: Player)
	local connections = playerConnections[player]
	if not connections then
		connections = {}
		playerConnections[player] = connections
	end

	if player.Character then
		characterAdded(player.Character)
	end
	table.insert(connections, player.CharacterAdded:Connect(characterAdded))
	table.insert(connections, player.CharacterRemoving:Connect(characterRemoving))
end

local function playerRemoving(player: Player)
	local connections = playerConnections[player]
	if connections then
		for _, conn in ipairs(connections) do
			conn:Disconnect()
		end
		playerConnections[player] = nil
	end

	if player.Character then
		characterRemoving(player.Character)
	end
end

for _, player in ipairs(Players:GetPlayers()) do
	task.spawn(playerAdded, player)
end
Players.PlayerAdded:Connect(playerAdded)
Players.PlayerRemoving:Connect(playerRemoving)


Prompt:
-- /**
--  * Return items (for example, of an array)
--  * with spacing, indentation, and comma
--  * without surrounding punctuation (for example, brackets)
--  **/

Response:
local function printListItems(
	list: { [number]: any },
	config: Config,
	indentation: string,
	depth: number,
	refs: Refs,
	printer: Printer
): string
	local result = ""

	if #list > 0 then
		result = result .. config.spacingOuter

		local indentationNext = indentation .. config.indent

		for i = 1, #list do
			result ..= indentationNext

			if list[i] ~= nil then
				result ..= printer(list[i], config, indentationNext, depth, refs)
			end

			-- ROBLOX deviation: < #list instead of #list - 1 because of 1-indexing
			if i < #list then
				result = result .. "," .. config.spacingInner
			elseif not config.min then
				result = result .. ","
			end
		end

		result = result .. config.spacingOuter .. indentation
	end

	return result
end

return {
	printTableEntries = printTableEntries,
	printListItems = printListItems,
}


Prompt: --Animation

Response:
local animController = script.Parent:WaitForChild'AnimationController'
local walk = Instance.new'Animation'
walk.AnimationId = game.ReplicatedStorage.NPCAnimations.GobblerWalk.AnimationId
walk = animController:LoadAnimation(walk)


Prompt:
--[[Config = require(script.Parent.Parent.Parent.Parent.Parent.CustomLabel)
CustomLabel = Config["CUSTOMFLOORLABEL"][tonumber(script.Parent.Parent.Name)]
script.Parent.SurfaceGui.Frame.TextLabel.Text = CustomLabel or script.Parent.Parent.Name]]

Response:
while true do
	script.Parent.SurfaceGui.Frame.ImageLabel.ImageColor3 = script.Parent.Parent.Light.Color
	if script.Parent.Parent.Light.Material == Enum.Material.Neon then
		script.Parent.SurfaceGui.LightInfluence = 0
	else
		script.Parent.SurfaceGui.LightInfluence = 1
	end
	wait()
end


Prompt:
-----------------
--| Constants |--
-----------------

Response:
local GRAVITY_ACCELERATION = workspace.Gravity

local RELOAD_TIME = 3 -- Seconds until tool can be used again
local ROCKET_SPEED = 60 -- Speed of the projectile

local MISSILE_MESH_ID = 'http://www.roblox.com/asset/?id=2251534'
local MISSILE_MESH_SCALE = Vector3.new(0.35, 0.35, 0.25)
local ROCKET_PART_SIZE = Vector3.new(1.2, 1.2, 3.27)