anuisud1

Untitled

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