Advertisement
Chaxsity

Untitled

Jun 12th, 2019
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1.  
  2. dir = 0
  3.  
  4. gs = game.GetService
  5. gs(game,"RunService").RenderStepped:connect(function()
  6. for i,v in next,workspace.Vehicles:children() do
  7. if v.Name ~= "Heli" then
  8. if v:FindFirstChild("Engine") then
  9. local bf,cf = v.Engine:FindFirstChild("NewForce"),v:GetPrimaryPartCFrame().lookVector
  10. if not bf then
  11. bf = v.Engine:FindFirstChild("BodyForce") or v.Engine:FindFirstChild("VectorForce")
  12. if bf then
  13. bf = bf:Clone()
  14. bf.Parent = v.Engine
  15. bf.Name = "NewForce"
  16. end
  17. end
  18. if bf then
  19. local fa = 1
  20. if v.Name:lower():find("bike") then fa = .3 elseif v.Name:lower():find("bugg") then fa = .5 end
  21. if v.Seat.PlayerName.Value ~= game:GetService("Players").LocalPlayer.Name then fa = 0 end
  22. bf.Force = Vector3.new(cf.X*500000*dir*fa,0,cf.Z*500000*dir*fa)
  23. end
  24. end
  25. end
  26. end
  27. end)
  28. val = {
  29. {Enum.KeyCode.W,1};
  30. {Enum.KeyCode.S,-1};
  31. }
  32. uis = gs(game,"UserInputService")
  33. chk = function(k)
  34. for i,v in next,val do
  35. if v[1]==k.KeyCode then
  36. return v[2]
  37. end
  38. end
  39. end
  40. uis.InputBegan:connect(function(k)
  41. dir = chk(k) or dir
  42. end)
  43. uis.InputEnded:connect(function(k)
  44. if chk(k) == dir then
  45. dir = 0
  46. end
  47. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement