Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- part = Instance.new("Part",script)
- part.Size = Vector3.new(4,1,7.5)
- part.Material = "SmoothPlastic"
- seat = Instance.new("VehicleSeat",script)
- seat.Size = Vector3.new(2,0.5,2)
- seat.Material = "SmoothPlastic"
- seat.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(0,0,-10)
- weld = Instance.new("Weld",seat)
- weld.Part0 = part
- weld.Part1 = seat
- weld.C0 = CFrame.new(0,0.5,0)
- bv = Instance.new("BodyVelocity",seat)
- bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
- bv.Velocity = Vector3.new()
- bg = Instance.new("BodyGyro",seat)
- bg.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
- bg.P = 10000
- steering = false
- going = false
- local function carMove(property)
- if property == "Throttle" then
- if seat.Throttle ~= 0 then
- going = true
- else
- going = false
- end
- elseif property == "Steer" then
- if seat.Steer ~= 0 then
- steering = true
- else
- steering = false
- end
- end
- end
- who = nil
- prox = Instance.new("ProximityPrompt",seat)
- prox.Style = Enum.ProximityPromptStyle.Custom
- prox2 = Instance.new("ProximityPrompt",seat)
- prox2.Style = Enum.ProximityPromptStyle.Custom
- prox3 = Instance.new("ProximityPrompt",seat)
- prox3.Style = Enum.ProximityPromptStyle.Custom
- prox4 = Instance.new("ProximityPrompt",seat)
- prox4.Style = Enum.ProximityPromptStyle.Custom
- prox5 = Instance.new("ProximityPrompt",seat)
- prox5.Style = Enum.ProximityPromptStyle.Custom
- prox6 = Instance.new("ProximityPrompt",seat)
- prox6.Style = Enum.ProximityPromptStyle.Custom
- prox7 = Instance.new("ProximityPrompt",seat)
- prox7.Style = Enum.ProximityPromptStyle.Custom
- seat.Changed:Connect(carMove)
- seat:GetPropertyChangedSignal("Occupant"):Connect(function()
- if seat.Occupant then
- local Model = seat.Occupant:FindFirstAncestorOfClass("Model")
- if Model then
- local PC = game:GetService("Players"):GetPlayerFromCharacter(Model)
- if PC then
- who = PC
- else
- who = nil
- end
- else
- who = nil
- end
- else
- who = nil
- end
- end)
- up = false
- prox.Enabled = true
- prox.Triggered:Connect(function(player)
- if player == who then
- up = true
- end
- end)
- prox.TriggerEnded:Connect(function(player)
- if player == who then
- up = false
- end
- end)
- down = false
- prox2.Enabled = true
- prox2.KeyboardKeyCode = Enum.KeyCode.Q
- prox2.Triggered:Connect(function(player)
- if player == who then
- down = true
- end
- end)
- prox2.TriggerEnded:Connect(function(player)
- if player == who then
- down = false
- end
- end)
- left = false
- prox3.Enabled = true
- prox3.KeyboardKeyCode = Enum.KeyCode.Z
- prox3.Triggered:Connect(function(player)
- if player == who then
- left = true
- end
- end)
- prox3.TriggerEnded:Connect(function(player)
- if player == who then
- left = false
- end
- end)
- right = false
- prox4.Enabled = true
- prox4.KeyboardKeyCode = Enum.KeyCode.C
- prox4.Triggered:Connect(function(player)
- if player == who then
- right = true
- end
- end)
- prox4.TriggerEnded:Connect(function(player)
- if player == who then
- right = false
- end
- end)
- rup = false
- prox5.Enabled = true
- prox5.KeyboardKeyCode = Enum.KeyCode.R
- prox5.Triggered:Connect(function(player)
- if player == who then
- rup = true
- end
- end)
- prox5.TriggerEnded:Connect(function(player)
- if player == who then
- rup = false
- end
- end)
- rdown = false
- prox6.Enabled = true
- prox6.KeyboardKeyCode = Enum.KeyCode.F
- prox6.Triggered:Connect(function(player)
- if player == who then
- rdown = true
- end
- end)
- prox6.TriggerEnded:Connect(function(player)
- if player == who then
- rdown = false
- end
- end)
- level = false
- prox7.Enabled = true
- prox7.KeyboardKeyCode = Enum.KeyCode.X
- prox7.Triggered:Connect(function(player)
- coroutine.wrap(function()
- if player == who then
- level = true
- wait()
- level = false
- end
- end)()
- end)
- while true do
- task.wait()
- if steering then
- bg.CFrame = bg.CFrame * CFrame.Angles(0,math.rad(seat.Steer * -2),0)
- end
- if going then
- seat.CFrame = seat.CFrame * CFrame.new(0,0,seat.Throttle * -0.5)
- end
- if up then
- seat.CFrame = seat.CFrame * CFrame.new(0,0.5,0)
- elseif down then
- seat.CFrame = seat.CFrame * CFrame.new(0,-0.5,0)
- end
- if left then
- bg.CFrame = bg.CFrame * CFrame.Angles(0,0,math.rad(2))
- elseif right then
- bg.CFrame = bg.CFrame * CFrame.Angles(0,0,math.rad(-2))
- end
- if rup then
- bg.CFrame = bg.CFrame * CFrame.Angles(math.rad(2),0,0)
- elseif rdown then
- bg.CFrame = bg.CFrame * CFrame.Angles(math.rad(-2),0,0)
- end
- if level then
- local x,y,z = bg.CFrame:ToOrientation()
- bg.CFrame = CFrame.Angles(0,y,0)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement