PiggyGaming2020

Vehicle Float

Oct 13th, 2022
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. --Keybinds
  2. -- F - Toggle
  3. -- R - UP
  4. -- Y - Down
  5.  
  6.  
  7.  
  8. local toggled = false
  9. local goingup = false
  10. local goingdown = false
  11. local plr = game.Players.LocalPlayer
  12. local char = game.Workspace:WaitForChild(plr.Name)
  13. local plrY = char.HumanoidRootPart.Position.Y
  14.  
  15. plr:GetMouse().KeyDown:Connect(function(key)
  16. if key == "f" then
  17. print("toggled")
  18.  
  19. if toggled == false then
  20. toggled = true
  21. part.Transparency = 0.5
  22. part.CanCollide = true
  23. plrY = char.HumanoidRootPart.Position.Y
  24. else
  25. toggled = false
  26. part.Transparency = 1
  27. part.CanCollide = false
  28. end
  29. end
  30. if key == "r" then
  31. --plrY = plrY + 1
  32. goingup = true
  33. end
  34. if key == "y" then
  35. --plrY = plrY - 1
  36. goingdown = true
  37. end
  38. end)
  39.  
  40. plr:GetMouse().KeyUp:Connect(function(key)
  41. if key == "r" then
  42. goingup = false
  43. end
  44. if key == "y" then
  45. goingdown = false
  46. end
  47. end)
  48.  
  49. part = Instance.new("Part")
  50. part.Parent = game.Workspace
  51. part.Name = "float"
  52.  
  53. part.Size = Vector3.new(75, 1, 75)
  54. part.Anchored = true
  55. part.CanCollide = false
  56. part.Transparency = 0
  57.  
  58. while true do
  59. if toggled == true then
  60. local plrPos = char.HumanoidRootPart.Position
  61. part.Position = Vector3.new(plrPos.X, plrY - 4, plrPos.Z)
  62. end
  63. if goingup == true then
  64. plrY = plrY + 0.5
  65. elseif goingdown == true then
  66. plrY = plrY - 0.5
  67. end
  68. wait()
  69. end
  70.  
Advertisement
Add Comment
Please, Sign In to add comment