Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local seat = game.Workspace.VehicleSeat
- local part = game.Workspace.Part
- local bodyGyro = game.Workspace.Part.BodyGyro
- local bodyVelocity = game.Workspace.Part.BodyVelocity
- local RunService = game:GetService('RunService')
- seat:GetPropertyChangedSignal("Occupant"):Connect(function(hum)
- if game.Players:GetPlayerFromCharacter(seat.Occupant.Parent) then
- local plr = game.Players:GetPlayerFromCharacter(seat.Occupant.Parent)
- local currentAngle = 0
- local rs = RunService.RenderStepped:Connect(function(step)
- bodyVelocity.Velocity = (part.CFrame.LookVector * 10)
- end)
- seat:GetPropertyChangedSignal("Throttle"):Connect(function(throttle)
- if throttle == 1 then
- print("Increase throttle")
- elseif throttle == 0 then
- print("Do nothing to throttle")
- elseif throttle == -1 then
- print("Decrease throttle")
- end
- end)
- seat:GetPropertyChangedSignal("Steer"):Connect(function(steer)
- if seat.Steer == -1 then
- print("Angle +1")
- repeat wait(.05)
- currentAngle = currentAngle + 4
- bodyGyro.CFrame = CFrame.Angles(math.rad(0), math.rad(currentAngle), math.rad(0))
- until seat.Steer ~= -1
- elseif seat.Steer == 0 then
- print("Do nothing to angle")
- elseif seat.Steer == 1 then
- print("Angle -1")
- repeat wait(.05)
- currentAngle = currentAngle - 4
- bodyGyro.CFrame = CFrame.Angles(math.rad(0), math.rad(currentAngle), math.rad(0))
- until seat.Steer ~= 1
- end
- print(currentAngle)
- end)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement