Pinkstack/roblox-luau-corpus-text huggingface dataset:
-- Functions 



function SPRING.create(mass, force, damping, speed)
	local spring	= {
		Target		= Vector3.new();
		Position	= Vector3.new();
		Velocity	= Vector3.new();
		Time 		= 0;

		Mass		= mass or 5;
		Force		= force or 50;
		Damping		= damping or 4;
		Speed		= speed  or 4;
	}

	return setmetatable(spring, Meta)
end

function SPRING:shove(force)
	local x, y, z	= force.X, force.Y, force.Z
	if x == math.huge or x == -math.huge then
		x	= 0
	end
	if y == math.huge or y == -math.huge then
		y	= 0
	end
	if z == math.huge or z == -math.huge then
		z	= 0
	end
	self.Velocity	+= Vector3.new(x, y, z)
end

function SPRING:update(dt)
	local Time = math.min(self.Time + dt * self.Speed, FixedRate * MaxSkips)
	
	for i = 1, math.floor(Time / FixedRate) * ITERATIONS do
		local iterationForce = self.Target - self.Position
		local acceleration	 = (iterationForce * self.Force) / self.Mass

		acceleration	-= self.Velocity * self.Damping

		self.Velocity	+= acceleration * iterdt
		self.Position	+= self.Velocity * iterdt
		Time -= iterdt
	end
	
	self.Time = Time
	if self.Position.Magnitude > .00001 then
		return self.Position
	end
	return Vector3.zero
end
-- FUNCTIONS --


Tool.Equipped:Connect(function()
	SkillsHandler:FireServer("Equip")

	Char = Tool.Parent
	HumRP = Char:WaitForChild("HumanoidRootPart")
	Humanoid = Char:WaitForChild("Humanoid")

	Animations = {
		["Z"] = Humanoid:LoadAnimation(script.Animations.Z),
		["X"] = Humanoid:LoadAnimation(script.Animations.X),
		["C"] = Humanoid:LoadAnimation(script.Animations.C),
		["V"] = Humanoid:LoadAnimation(script.Animations.V),
		["R"] = Humanoid:LoadAnimation(script.Animations.R),
	}
end)

Tool.Unequipped:Connect(function()
	SkillsHandler:FireServer("Unequip")
end)
--[[Transmission]]


	Tune.TransModes		= {"Auto","Semi"}								--[[
	[Modes]
		"Auto"		: Automatic shifting
		"Semi"		: Clutchless manual shifting, dual clutch transmission
		"Manual"	: Manual shifting with clutch
		
		>Include within brackets
			eg: {"Semi"} or {"Auto", "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		= 3.4			-- Gearing determines top speed and wheel torque
	Tune.Ratios			= {				-- Higher ratio = more torque, Lower ratio = higher top speed
		--[[Reverse]]	3			,	-- Copy and paste a ratio to add a gear
		--[[Neutral]]	0			,	-- Ratios can also be deleted
		--[[ 1 ]]		5.5			,	-- Reverse, Neutral, and 1st gear are required
		--[[ 2 ]]		2.5			,
		--[[ 3 ]]		1.95			,
		--[[ 4 ]]		1.40			,
		--[[ 5 ]]		0.80		,
	--[[ 6 ]]    	0.55        ,
	
		
		
	}
	Tune.FDMult			= 1.5			-- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
-- Visualizes an impact. This will not run if FastCast.VisualizeCasts is false.


function DbgVisualizeHit(atCF: CFrame, wasPierce: boolean): SphereHandleAdornment?
	if ClientSettings.Debug.Value == false then return nil end
	local adornment = Instance.new("SphereHandleAdornment")
	adornment.Adornee = workspace.Terrain
	adornment.CFrame = atCF
	adornment.Radius = 0.1
	adornment.Transparency = 0.25
	adornment.Color3 = (wasPierce == false) and Color3.new(0.2, 1, 0.5) or Color3.new(1, 0.2, 0.2)
	adornment.Parent = GetFastCastVisualizationContainer()
	Debris:AddItem(adornment, 3)
	return adornment
end
--[=[
	@return any
	Returns the current value for the given player. This value
	will depend on if `SetFor` or `SetFilter` has affected the
	custom value for the player. If so, that custom value will
	be returned. Otherwise, the top-level value will be used
	(e.g. value from `Set`).

	```lua
	-- Set top level data:
	remoteProperty:Set("Data")
	print(remoteProperty:GetFor(somePlayer)) --> "Data"

	-- Set custom data:
	remoteProperty:SetFor(somePlayer, "CustomData")
	print(remoteProperty:GetFor(somePlayer)) --> "CustomData"

	-- Set top level again, overriding custom data:
	remoteProperty:Set("NewData")
	print(remoteProperty:GetFor(somePlayer)) --> "NewData"

	-- Set custom data again, and set top level without overriding:
	remoteProperty:SetFor(somePlayer, "CustomData")
	remoteProperty:SetTop("Data")
	print(remoteProperty:GetFor(somePlayer)) --> "CustomData"

	-- Clear custom data to use top level data:
	remoteProperty:ClearFor(somePlayer)
	print(remoteProperty:GetFor(somePlayer)) --> "Data"
	```
]=]


function RemoteProperty:GetFor(player: Player): any
	local playerValue = self._perPlayer[player]
	local value = if playerValue == nil then self._value elseif playerValue == None then nil else playerValue
	return value
end
-- CONSTANTS



local GuiLib = script.Parent.Parent
local Lazy = require(GuiLib:WaitForChild("LazyLoader"))

local UIS = game:GetService("UserInputService")
local RUNSERVICE = game:GetService("RunService")

local DEADZONE2 = 0.15^2
local FLIP_THUMB = Vector3.new(1, -1, 1)

local VALID_PRESS = {
	[Enum.UserInputType.MouseButton1] = true;
	[Enum.UserInputType.Touch] = true;
}

local VALID_MOVEMENT = {
	[Enum.UserInputType.MouseMovement] = true;
	[Enum.UserInputType.Touch] = true;
}
--// All global vars will be wiped/replaced except script
--// All guis are autonamed client.Variables.CodeName..gui.Name
--// Be sure to update the console gui's code if you change stuff



return function(data)
	if not data.Question then return end
	
	local gTable = data.gTable
	local baseClip = script.Parent.Parent.BaseClip
	local duration = data.Duration or data.Timeout
	
	local toReturn
	local confirmationTemplate = baseClip.Frame
	local confirmationClone = confirmationTemplate
	confirmationClone.Parent = baseClip
	confirmationClone.Position = UDim2.new(0.5,-210,0,-confirmationClone.Size.Y.Offset)
	confirmationClone.Visible = true
	local Body = confirmationClone:WaitForChild('Body')
	local Options = Body:WaitForChild('Options')
	local Confirm,Cancel = Options:WaitForChild('Confirm'),Options:WaitForChild('Cancel')
	local commandText = Body:WaitForChild('Command')
	local title = confirmationTemplate.Top.Title
	
	commandText.Text = data.Subtitle or " "
	Body.Ques.Text = data.Question or "Unknown"
	title.Text = data.Title or "Yes/No Prompt"
	
	Body.Options.Cancel.Text = data.No or "No"
	Body.Options.Confirm.Text = data.Yes or "Yes"
	
	gTable:Ready()
	
	gTable.CustomDestroy = function()
		gTable.CustomDestroy = nil
		gTable.ClearEvents()
		if toReturn == nil then toReturn = data.No or "No" end
		
		pcall(function()
			confirmationClone:TweenPosition(UDim2.new(0.5,-210,1,0),"Out",'Quint',0.3,true,function(Stat)
				if Stat == Enum.TweenStatus.Completed then
					confirmationClone:Destroy()
				end
			end)
			
			wait(0.3)
		end)
		
		gTable:Destroy()
	end
	
	confirmationClone:TweenPosition(UDim2.new(0.5,-210,0.5,-70),"Out",'Quint',0.3,true)
	local Confirming; Confirming = gTable.BindEvent(Confirm.MouseButton1Click, function()
		Confirming:Disconnect()
		confirmationClone:TweenPosition(UDim2.new(0.5,-210,1,0),"Out",'Quint',0.3,true,function(Stat)
			if Stat == Enum.TweenStatus.Completed then
				confirmationClone:Destroy()
			end
		end)
		
		toReturn = data.Yes or "Yes"
		wait(0.3)
		gTable:Destroy()
	end)
	
	local Cancelling; Cancelling = gTable.BindEvent(Cancel.MouseButton1Click, function()
		Cancelling:Disconnect()
		confirmationClone:TweenPosition(UDim2.new(0.5,-210,1,0),"Out",'Quint',0.3,true,function(Stat)
			if Stat == Enum.TweenStatus.Completed then
				confirmationClone:Destroy()
			end
		end)
		toReturn = data.No or "No"
		wait(0.3)
		gTable:Destroy()
	end)
	
	local start = tick()
	repeat
		wait()
	until toReturn ~= nil or (duration and (tick()-duration) > duration)
	if toReturn == nil then toReturn = false end
	
	return toReturn
end
--[[
class Spring

Description:
	A physical model of a spring, useful in many applications. Properties only evaluate
	upon index making this model good for lazy applications

API:
	Spring = Spring.new(number position)
		Creates a new spring in 1D
	Spring = Spring.new(Vector3 position)
		Creates a new spring in 3D

	Spring.Position
		Returns the current position
	Spring.Velocity
		Returns the current velocity
	Spring.Target
		Returns the target
	Spring.Damper
		Returns the damper
	Spring.Speed
		Returns the speed

	Spring.Target = number/Vector3
		Sets the target
	Spring.Position = number/Vector3
		Sets the position
	Spring.Velocity = number/Vector3
		Sets the velocity
	Spring.Damper = number [0, 1]
		Sets the spring damper, defaults to 1
	Spring.Speed = number [0, infinity)
		Sets the spring speed, defaults to 1

	Spring:TimeSkip(number DeltaTime)
		Instantly skips the spring forwards by that amount of now
	Spring:Impulse(number/Vector3 velocity)
		Impulses the spring, increasing velocity by the amount given
]]




local Spring = {}
--[[
		___      _______                _     
	   / _ |____/ ___/ /  ___ ____ ___ (_)__ 
	  / __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
	 /_/ |_|   \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare on soundscript, Truenus on script
]]


wait(0.4)
local car = script.Parent.Car.Value
local revon = car.DriveSeat.Rev
local revoff = car.DriveSeat.RevOFF
local throttle = script.Parent.Values.Throttle

throttle.Changed:connect(function()
	if throttle.Value == 1 then 
		revon.Volume=0.50
		revoff.Volume=0.75
		wait(0.025)
		revon.Volume=0.50
		revoff.Volume=0.50
		wait(0.025)
		revon.Volume=0.75
		revoff.Volume=0.25
		wait(0.025)
		revon.Volume=1
		revoff.Volume=0
	else
		revon.Volume=0.75
		revoff.Volume=0.25
		wait(0.025)
		revon.Volume=0.50
		revoff.Volume=0.50
		wait(0.025)
		revon.Volume=0.25
		revoff.Volume=0.75
		wait(0.025)
		revon.Volume=0
		revoff.Volume=1
	end
end)
-- (Hat Giver Script - Loaded.)



debounce = true

function onTouched(hit)
	if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
		debounce = false
		h = Instance.new("Hat")
		p = Instance.new("Part")
		h.Name = "Belgium hat"
		p.Parent = h
		p.Position = hit.Parent:findFirstChild("Head").Position
		p.Name = "Handle" 
		p.formFactor = 0
		p.Size = Vector3.new(1, 1.2, 1) 
		p.BottomSurface = 0 
		p.TopSurface = 0 
		p.Locked = true 
		script.Parent.Mesh:clone().Parent = p
		h.Parent = hit.Parent
		h.AttachmentForward = Vector3.new (-0, -0, -1)
		h.AttachmentPos = Vector3.new(0, -0.2, 0.05)
		h.AttachmentRight = Vector3.new (1, 0, 0)
		h.AttachmentUp = Vector3.new (0, 1, 0)
		wait(5)
		debounce = true
	end
end

script.Parent.Touched:connect(onTouched)
------------------
--SPAWNING--
------------------


miked=script.Parent

itlh=miked.Torso:findFirstChild("Left Hip")
itlh.Part0=miked.Torso
itlh.Part1=miked:findFirstChild("Left Leg")
itlh.C0=CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)

itrh=miked.Torso:findFirstChild("Right Hip")
itrh.Part0=miked.Torso
itrh.Part1=miked:findFirstChild("Right Leg")
itrh.C0=CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)

itls=miked.Torso:findFirstChild("Left Shoulder")
itls.Part1=miked.Torso
itls.C0=CFrame.new(2, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
itls.Part0=miked:findFirstChild("Left Arm")

itrs=miked.Torso:findFirstChild("Right Shoulder")
itrs.Part1=miked.Torso
itrs.C0=CFrame.new(-2, 0.5, 0, 0, 0, 1, 0, -1, 0, 1, 0, 0)
itrs.Part0=miked:findFirstChild("Right Arm")

miked.Head:makeJoints()

wait(3)
miked:findFirstChild("Left Arm").Anchored = false
miked:findFirstChild("Right Arm").Anchored = false
-- This is pcalled because the SetCore methods may not be released yet.


pcall(function()
	PlayerBlockedEvent = StarterGui:GetCore("PlayerBlockedEvent")
	PlayerMutedEvent = StarterGui:GetCore("PlayerMutedEvent")
	PlayerUnBlockedEvent = StarterGui:GetCore("PlayerUnblockedEvent")
	PlayerUnMutedEvent = StarterGui:GetCore("PlayerUnmutedEvent")
end)

function SendSystemMessageToSelf(message)
	local currentChannel = ChatWindow:GetCurrentChannel()

	if currentChannel then
		local messageData =
		{
			ID = -1,
			FromSpeaker = nil,
			SpeakerUserId = 0,
			OriginalChannel = currentChannel.Name,
			IsFiltered = true,
			MessageLength = string.len(message),
			Message = trimTrailingSpaces(message),
			MessageType = ChatConstants.MessageTypeSystem,
			Time = os.time(),
			ExtraData = nil,
		}

		currentChannel:AddMessageToChannel(messageData)
	end
end

function MutePlayer(player)
	local mutePlayerRequest = DefaultChatSystemChatEvents:FindFirstChild("MutePlayerRequest")
	if mutePlayerRequest then
		return mutePlayerRequest:InvokeServer(player.Name)
	end
	return false
end

if PlayerBlockedEvent then
	PlayerBlockedEvent.Event:connect(function(player)
		if MutePlayer(player) then
			SendSystemMessageToSelf(
				string.gsub(
					ChatLocalization:Get(
						"GameChat_ChatMain_SpeakerHasBeenBlocked", 
						string.format("Speaker '%s' has been blocked.", player.Name)
					),
					"{RBX_NAME}",player.Name
				)
			)
		end
	end)
end

if PlayerMutedEvent then
	PlayerMutedEvent.Event:connect(function(player)
		if MutePlayer(player) then
			SendSystemMessageToSelf(
				string.gsub(
					ChatLocalization:Get(
						"GameChat_ChatMain_SpeakerHasBeenMuted", 
						string.format("Speaker '%s' has been muted.", player.Name)
					),
					"{RBX_NAME}", player.Name
				)
			)
		end
	end)
end

function UnmutePlayer(player)
	local unmutePlayerRequest = DefaultChatSystemChatEvents:FindFirstChild("UnMutePlayerRequest")
	if unmutePlayerRequest then
		return unmutePlayerRequest:InvokeServer(player.Name)
	end
	return false
end

if PlayerUnBlockedEvent then
	PlayerUnBlockedEvent.Event:connect(function(player)
		if UnmutePlayer(player) then
			SendSystemMessageToSelf(
				string.gsub(
					ChatLocalization:Get(
						"GameChat_ChatMain_SpeakerHasBeenUnBlocked", 
						string.format("Speaker '%s' has been unblocked.", player.Name)
					),
					"{RBX_NAME}",player.Name
				)
			)
		end
	end)
end

if PlayerUnMutedEvent then
	PlayerUnMutedEvent.Event:connect(function(player)
		if UnmutePlayer(player) then
			SendSystemMessageToSelf(
				string.gsub(
					ChatLocalization:Get(
						"GameChat_ChatMain_SpeakerHasBeenUnMuted", 
						string.format("Speaker '%s' has been unmuted.", player.Name)
					),
					"{RBX_NAME}",player.Name
				)
			)
		end
	end)
end
--------RIGHT DOOR --------


game.Workspace.doorright.l11.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l31.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l12.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l22.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l42.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l61.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l53.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l72.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l41.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l52.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l23.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l63.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l71.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l33.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)

game.Workspace.doorright.l21.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.doorright.l13.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.doorright.l73.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.doorright.l62.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.doorright.l51.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.doorright.l32.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.doorright.l43.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)

game.Workspace.doorright.pillar.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
--[=[
	Chains onto an existing Promise and returns a new Promise.

	:::warning
	Within the failure handler, you should never assume that the rejection value is a string. Some rejections within the Promise library are represented by [[Error]] objects. If you want to treat it as a string for debugging, you should call `tostring` on it first.
	:::

	Return a Promise from the success or failure handler and it will be chained onto.

	@param successHandler (...: any) -> ...any
	@param failureHandler? (...: any) -> ...any
	@return Promise<...any>
]=]


function Promise.prototype:andThen(successHandler, failureHandler)
	assert(
		successHandler == nil or type(successHandler) == "function",
		string.format(ERROR_NON_FUNCTION, "Promise:andThen")
	)
	assert(
		failureHandler == nil or type(failureHandler) == "function",
		string.format(ERROR_NON_FUNCTION, "Promise:andThen")
	)

	return self:_andThen(debug.traceback(nil, 2), successHandler, failureHandler)
end
--//Shifting//-


if key == "1" then
	carSeat.Wheels.FR.Spring.Stiffness = 900
 	carSeat.Wheels.FL.Spring.Stiffness = 900
	carSeat.Wheels.RR.Spring.Stiffness = 900
	carSeat.Wheels.RL.Spring.Stiffness = 900
	carSeat.Wheels.FR.Spring.MinLength = 1.6
	carSeat.Wheels.FL.Spring.MinLength = 1.6
	carSeat.Wheels.RR.Spring.MinLength = 1.6
	carSeat.Wheels.RL.Spring.MinLength = 1.6
	car.DriveSeat.Air:Play()
	wait(0.1)
	carSeat.Wheels.FR.Spring.Stiffness = 900
 	carSeat.Wheels.FL.Spring.Stiffness = 900
	carSeat.Wheels.RR.Spring.Stiffness = 900
	carSeat.Wheels.RL.Spring.Stiffness = 900
	carSeat.Wheels.FR.Spring.MinLength = 1.575
	carSeat.Wheels.FL.Spring.MinLength = 1.575
	carSeat.Wheels.RR.Spring.MinLength = 1.575
	carSeat.Wheels.RL.Spring.MinLength = 1.575
	wait(0.1)
	carSeat.Wheels.FR.Spring.Stiffness = 900
 	carSeat.Wheels.FL.Spring.Stiffness = 900
	carSeat.Wheels.RR.Spring.Stiffness = 900
	carSeat.Wheels.RL.Spring.Stiffness = 900
	carSeat.Wheels.FR.Spring.MinLength = 1.560
	carSeat.Wheels.FL.Spring.MinLength = 1.560
	carSeat.Wheels.RR.Spring.MinLength = 1.560
	carSeat.Wheels.RL.Spring.MinLength = 1.560
	wait(0.1)
	carSeat.Wheels.FR.Spring.Stiffness = 900
 	carSeat.Wheels.FL.Spring.Stiffness = 900
	carSeat.Wheels.RR.Spring.Stiffness = 900
	carSeat.Wheels.RL.Spring.Stiffness = 900
	carSeat.Wheels.FR.Spring.MinLength = 1.545
	carSeat.Wheels.FL.Spring.MinLength = 1.545
	carSeat.Wheels.RR.Spring.MinLength = 1.545
	carSeat.Wheels.RL.Spring.MinLength = 1.545
	car.DriveSeat.Air:Stop()
elseif key == "2" then
	carSeat.Wheels.FR.Spring.Stiffness = 9000
	carSeat.Wheels.FL.Spring.Stiffness = 9000
	carSeat.Wheels.RR.Spring.Stiffness = 9000
	carSeat.Wheels.RL.Spring.Stiffness = 9000
elseif key == "3" then
	carSeat.Wheels.RR.Spring.Stiffness = 1500
	carSeat.Wheels.RL.Spring.Stiffness = 1500
elseif key == "4" then
	carSeat.Wheels.FR.Spring.Stiffness = 1500
	carSeat.Wheels.FL.Spring.Stiffness = 1500
	end
end)
----------------------------------
-----------CONNECTIONS------------
----------------------------------



KeyboardConnection = nil
JumpConnection = nil
FocusConnection = InputService.TextBoxFocused:connect(TextFocus) --always needs to be connected
UnfocusConnection = InputService.TextBoxFocusReleased:connect(TextUnfocus)

function MakeKeyboardConnections()
	KeyboardConnection = InputService.InputBegan:connect(Input)
	
end
function BreakKeyboardConnections()
	KeyboardConnection:disconnect()
end
--Scripted by DermonDarble



local userInputService = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character.Humanoid
local horse = script:WaitForChild("Horse").Value
local horsemain = script.Parent.Parent.Parent
local sprinting = false

local horseGui = script:WaitForChild("HorseGui")
horseGui.Parent = player.PlayerGui

local rideAnimation = humanoid:LoadAnimation(horse.Animations.Ride)
rideAnimation:Play()

local movement = Vector3.new(0, 0, 0)

userInputService.InputBegan:connect(function(inputObject, gameProcessedEvent)
	if not gameProcessedEvent then
		if inputObject.KeyCode == Enum.KeyCode.W or inputObject.KeyCode == Enum.KeyCode.Up then
			movement = Vector3.new(movement.X, movement.Y, -1)
		elseif inputObject.KeyCode == Enum.KeyCode.S or inputObject.KeyCode == Enum.KeyCode.Down then
			movement = Vector3.new(movement.X, movement.Y, 1)
		elseif inputObject.KeyCode == Enum.KeyCode.A or inputObject.KeyCode == Enum.KeyCode.Left then
			movement = Vector3.new(-1, movement.Y, movement.Z)
		elseif inputObject.KeyCode == Enum.KeyCode.D or inputObject.KeyCode == Enum.KeyCode.Right then
			movement = Vector3.new(1, movement.Y, movement.Z)
		elseif inputObject.KeyCode == Enum.KeyCode.LeftShift then
			if horse.Humanoid.WalkSpeed == 45 then
				horse.Humanoid.WalkSpeed = 16
			else
				horse.Humanoid.WalkSpeed = 45
			end
			
		elseif inputObject.KeyCode == Enum.KeyCode.Q then
			local ray = Ray.new(horse.HumanoidRootPart.Position + Vector3.new(0, -4.3, 0), Vector3.new(0, -1, 0))
			local hit, position = game.Workspace:FindPartOnRay(ray, horse)
			if hit and hit.CanCollide then
				horse.Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
			end
		elseif inputObject.KeyCode == Enum.KeyCode.Space then
			humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
		end
	end
end)

userInputService.InputEnded:connect(function(inputObject, gameProcessedEvent)
	if not gameProcessedEvent then
		if inputObject.KeyCode == Enum.KeyCode.W or inputObject.KeyCode == Enum.KeyCode.Up then
			if movement.Z < 0 then
				movement = Vector3.new(movement.X, movement.Y, 0)
			end
		elseif inputObject.KeyCode == Enum.KeyCode.S or inputObject.KeyCode == Enum.KeyCode.Down then
			if movement.Z > 0 then
				movement = Vector3.new(movement.X, movement.Y, 0)
			end
		elseif inputObject.KeyCode == Enum.KeyCode.A or inputObject.KeyCode == Enum.KeyCode.Left then
			if movement.X < 0 then
				movement = Vector3.new(0, movement.Y, movement.Z)
			end
		elseif inputObject.KeyCode == Enum.KeyCode.D or inputObject.KeyCode == Enum.KeyCode.Right then
			if movement.X > 0 then
				movement = Vector3.new(0, movement.Y, movement.Z)
			end
		end
	end
end)

spawn(function()
	while horse.Seat.Occupant == humanoid do
		game:GetService("RunService").RenderStepped:wait()
		horse.Humanoid:Move(movement, true)
	end
	horseGui:Destroy()
	humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
	horse.Humanoid:Move(Vector3.new())
	rideAnimation:Stop()
	script:Destroy()
end)
--Ahoj, vím že ze koukaš na tenhle script, tohle je muj první door script. neočekavej že to bude fungovat



local TweenService = game:GetService("TweenService")
local Hinge = script.Parent
local clickDetector = script.Parent.Parent.MainDoor.ClickDetector

local Goal = {
	CFrame = Hinge.CFrame * CFrame.Angles(0,math.rad(-78),0)
}

local Goal2 = {
	CFrame = Hinge.CFrame * CFrame.Angles(0,0,0)
}

local tweenInfo = TweenInfo.new(1)

local doorOpen = TweenService:Create(Hinge, tweenInfo, Goal)
local doorClose = TweenService:Create(Hinge, tweenInfo, Goal2)

local isOpen = false

clickDetector.MouseClick:Connect(function()
	if isOpen == false then
		doorOpen:Play()
		isOpen = true
	else
		doorClose:Play()
		isOpen = false
	end
end)
--CARPLAY VARIABLES--


local handler = car:WaitForChild("CarPlay_Handler")
local driveseat = car.DriveSeat
local home = script.Parent:WaitForChild("CarPlay"):WaitForChild("Homescreen"):WaitForChild("Apps")
local side = script.Parent:WaitForChild("CarPlay").Side
local music = script.Parent:WaitForChild("CarPlay").Music
local filter = car.DriveSeat:WaitForChild('Filter')
local nowplaying = script.Parent:WaitForChild("CarPlay").NowPlaying
local songData = script.Parent.CarPlay_Data.NowPlayingData.SongNumber
local RecentAppEnabled = true --by default
local debounce = false