local G=script.Parent local M=G.Configuration local t=nil local m=false local D=0 local n=0 G.ChildAdded:connect(function(m)if m.className=="\087\101\108\100"and m.Name=="\083\101\097\116\087\101\108\100"then local D=m.Part1.Parent local n=game.Players:FindFirstChild(D.Name)if n~=nil then t=n G.ChildRemoved:connect(function(G)if G==m then t=nil end end)G.BodyVelocity.maxForce=Vector3.new(1,1,1)*M.MaxForce.Value G.BodyGyro.maxTorque=Vector3.new(1,1,1)*50000 local D=0 local E=G.ScreenGui:clone()E.Parent=n.PlayerGui E.Frame.Faster.MouseButton1Click:connect(function()D=math.min(D+M.MaxSpeed.Value/20,M.MaxSpeed.Value)E.Frame.Speed.Text=math.floor(D)end)E.Frame.Slower.MouseButton1Click:connect(function()D=math.max(D-M.MaxSpeed.Value/20,0)E.Frame.Speed.Text=math.floor(D)end)while t==n do G.BodyVelocity.velocity=G.CFrame.lookVector*D wait()end E:remove()G.BodyVelocity.velocity=Vector3.new(0,0,0)G.BodyVelocity.maxForce=Vector3.new(0,0,0)G.BodyGyro.maxTorque=Vector3.new(0,0,0)end end end)G.Changed:connect(function()if not m then local t=G.Steer local E=G.Throttle m=true while t~=0 or E~=0 do n=n-G.Steer*M.TurnSpeed.Value D=D-G.Throttle*M.TurnSpeed.Value G.BodyGyro.cframe=(CFrame.new(0,0,0)*CFrame.Angles(0,math.rad(n),0))*CFrame.Angles(math.rad(D),0,0)wait()end m=false end end)
--------------MADE BY Radioaktiivinen
--------------Should be configurable with some crappy configuration tool of roblox >_>
local seat = script.Parent
local data = seat.Configuration
local owner = nil
local running = false
local x = 0
local y = 0

seat.ChildAdded:connect(function(w)
	if w.className == "Weld" and w.Name == "SeatWeld" then
		local char = w.Part1.Parent
		local player = game.Players:FindFirstChild(char.Name)
		if player ~= nil then
			owner = player
			seat.ChildRemoved:connect(function(w2)
				if w2 == w then
					owner = nil
				end
			end)
			seat.BodyVelocity.maxForce = Vector3.new(1, 1, 1) * data.MaxForce.Value
			seat.BodyGyro.maxTorque = Vector3.new(1, 1, 1) * 50000
			local spd = 0
			local gui = seat.ScreenGui:clone()
			gui.Parent = player.PlayerGui
			gui.Frame.Faster.MouseButton1Click:connect(function()
				spd = math.min(spd + data.MaxSpeed.Value / 20, data.MaxSpeed.Value)
				gui.Frame.Speed.Text = math.floor(spd)
			end)
			gui.Frame.Slower.MouseButton1Click:connect(function()
				spd = math.max(spd - data.MaxSpeed.Value / 20, 0)
				gui.Frame.Speed.Text = math.floor(spd)
			end)
			while owner == player do
				seat.BodyVelocity.velocity = seat.CFrame.lookVector * spd
				wait()
			end
			gui:remove()
			seat.BodyVelocity.velocity = Vector3.new(0, 0, 0)
			seat.BodyVelocity.maxForce = Vector3.new(0, 0, 0)
			seat.BodyGyro.maxTorque = Vector3.new(0, 0, 0)
		end
	end
end)

seat.Changed:connect(function()
	if not running then
		local cur = seat.Steer
		local cur2 = seat.Throttle
		running = true
		while cur ~= 0 or cur2 ~= 0 do
			y = y - seat.Steer * data.TurnSpeed.Value
			x = x - seat.Throttle * data.TurnSpeed.Value
			seat.BodyGyro.cframe = CFrame.new(0, 0, 0)
				* CFrame.Angles(0, math.rad(y), 0)
				* CFrame.Angles(math.rad(x), 0, 0)
			wait()
		end
		running = false
	end
end)
