local g=game:GetService("\085\115\101\114\073\110\112\117\116\083\101\114\118\105\099\101")local h=game.Players.LocalPlayer local l=h.Character local V=l.Humanoid local G=(script:WaitForChild("\072\111\114\115\101")).Value local d=script.Parent.Parent.Parent local k=false local v=script:WaitForChild("\072\111\114\115\101\071\117\105")v.Parent=h.PlayerGui local i=V:LoadAnimation(G.Animations.Ride)i:Play()local t=Vector3.new(0,0,0)g.InputBegan:connect(function(g,h)if not h then if g.KeyCode==Enum.KeyCode.W or g.KeyCode==Enum.KeyCode.Up then t=Vector3.new(t.X,t.Y,-1)elseif g.KeyCode==Enum.KeyCode.S or g.KeyCode==Enum.KeyCode.Down then t=Vector3.new(t.X,t.Y,1)elseif g.KeyCode==Enum.KeyCode.A or g.KeyCode==Enum.KeyCode.Left then t=Vector3.new(-1,t.Y,t.Z)elseif g.KeyCode==Enum.KeyCode.D or g.KeyCode==Enum.KeyCode.Right then t=Vector3.new(1,t.Y,t.Z)elseif g.KeyCode==Enum.KeyCode.LeftShift then if G.Humanoid.WalkSpeed==45 then G.Humanoid.WalkSpeed=16 else G.Humanoid.WalkSpeed=45 end elseif g.KeyCode==Enum.KeyCode.Q then local g=Ray.new(G.HumanoidRootPart.Position+Vector3.new(0,-4.3,0),Vector3.new(0,-1,0))local h,l=game.Workspace:FindPartOnRay(g,G)if h and h.CanCollide then G.Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)end elseif g.KeyCode==Enum.KeyCode.Space then V:ChangeState(Enum.HumanoidStateType.Jumping)end end end)g.InputEnded:connect(function(g,h)if not h then if g.KeyCode==Enum.KeyCode.W or g.KeyCode==Enum.KeyCode.Up then if t.Z<0 then t=Vector3.new(t.X,t.Y,0)end elseif g.KeyCode==Enum.KeyCode.S or g.KeyCode==Enum.KeyCode.Down then if t.Z>0 then t=Vector3.new(t.X,t.Y,0)end elseif g.KeyCode==Enum.KeyCode.A or g.KeyCode==Enum.KeyCode.Left then if t.X<0 then t=Vector3.new(0,t.Y,t.Z)end elseif g.KeyCode==Enum.KeyCode.D or g.KeyCode==Enum.KeyCode.Right then if t.X>0 then t=Vector3.new(0,t.Y,t.Z)end end end end)spawn(function()while G.Seat.Occupant==V do(game:GetService("\082\117\110\083\101\114\118\105\099\101")).RenderStepped:wait()G.Humanoid:Move(t,true)end v:Destroy()V:SetStateEnabled(Enum.HumanoidStateType.Jumping,true)G.Humanoid:Move(Vector3.new())i:Stop()script:Destroy()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)
