local a=script.Parent:WaitForChild("\072\117\109\097\110\111\105\100")local x=nil a.Seated:Connect(function(a,B)x=B end)local B=false local Z=false local q=false local f=false;(game:GetService("\085\115\101\114\073\110\112\117\116\083\101\114\118\105\099\101")).InputBegan:Connect(function(a,x)if x then return end if a.KeyCode==Enum.KeyCode.W then B=true end if a.KeyCode==Enum.KeyCode.S then Z=true end if a.KeyCode==Enum.KeyCode.A then q=true end if a.KeyCode==Enum.KeyCode.D then f=true end end);(game:GetService("\085\115\101\114\073\110\112\117\116\083\101\114\118\105\099\101")).InputEnded:Connect(function(a)if a.KeyCode==Enum.KeyCode.W then B=false end if a.KeyCode==Enum.KeyCode.S then Z=false end if a.KeyCode==Enum.KeyCode.A then q=false end if a.KeyCode==Enum.KeyCode.D then f=false end end)local G=workspace.CurrentCamera local n=game.Players.LocalPlayer:GetMouse()local L=0;(game:GetService("\082\117\110\083\101\114\118\105\099\101")).RenderStepped:Connect(function()if x then print(q)print(f)G.CameraType=Enum.CameraType.Scriptable G.CFrame=x.Parent.Camera.CFrame*CFrame.Angles(math.rad(((n.Y-n.ViewSizeY/2)/n.ViewSizeY)*-20),math.rad(((n.X-n.ViewSizeX/2)/n.ViewSizeX)*-20),0)x.BodyGyro.CFrame=CFrame.new(x.Position,Vector3.new(n.Hit.X,n.Hit.Y,n.Hit.Z))*CFrame.Angles(0,0,math.rad(L))if B then x.BodyVelocity.Velocity=x.CFrame.LookVector*100 elseif Z then x.BodyVelocity.Velocity=x.CFrame.LookVector*-100 else x.BodyVelocity.Velocity=Vector3.new(0,0,0)end if q then L+=3 elseif f then L+=-3 else x.BodyAngularVelocity.AngularVelocity=Vector3.new(0,0,0)end else G.CameraType=Enum.CameraType.Custom end end)


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

hum.Seated:Connect(function(active, seatPart)
	seat = seatPart
end)

local w = false
local s = false
local a = false
local d = false

game:GetService("UserInputService").InputBegan:Connect(function(inp, processed)
	if processed then return end
	if inp.KeyCode == Enum.KeyCode.W then w = true end
	if inp.KeyCode == Enum.KeyCode.S then s = true end
	if inp.KeyCode == Enum.KeyCode.A then a = true end
	if inp.KeyCode == Enum.KeyCode.D then d = true end
end)

game:GetService("UserInputService").InputEnded:Connect(function(inp)
	if inp.KeyCode == Enum.KeyCode.W then w = false end
	if inp.KeyCode == Enum.KeyCode.S then s = false end
	if inp.KeyCode == Enum.KeyCode.A then a = false end
	if inp.KeyCode == Enum.KeyCode.D then d = false end
end)

local camera = workspace.CurrentCamera
local mouse = game.Players.LocalPlayer:GetMouse()
local aa = 0

game:GetService("RunService").RenderStepped:Connect(function()
	if seat then
		print(a)
		print(d)
		camera.CameraType = Enum.CameraType.Scriptable
		camera.CFrame = seat.Parent.Camera.CFrame * CFrame.Angles(math.rad((((mouse.Y - mouse.ViewSizeY / 2) / mouse.ViewSizeY)) * -20),math.rad((((mouse.X - mouse.ViewSizeX / 2) / mouse.ViewSizeX)) * -20),0)
		--seat.BodyGyro.CFrame = CFrame.new(seat.Parent.Body.Position, mouse.Hit.LookVector * 666)
		seat.BodyGyro.CFrame = CFrame.new(seat.Position, Vector3.new(mouse.Hit.X,mouse.Hit.Y,mouse.Hit.Z)) * CFrame.Angles(0, 0, math.rad(aa))
		if w then
			seat.BodyVelocity.Velocity = seat.CFrame.LookVector * 100
		elseif s then
			seat.BodyVelocity.Velocity = seat.CFrame.LookVector * -100
		else
			seat.BodyVelocity.Velocity = Vector3.new(0, 0, 0)
		end
		if a then
			aa+=3
		elseif d then
			aa+=-3
		else
			seat.BodyAngularVelocity.AngularVelocity = Vector3.new(0,0,0)
		end
	else 
		camera.CameraType = Enum.CameraType.Custom
	end
end)
