JimmyScripts

Float Tool SCRIPT

Jul 11th, 2024
1,094
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.80 KB | None | 0 0
  1. local tool = Instance.new("Tool")
  2. tool.RequiresHandle = false
  3. tool.Name = "Float"
  4.  
  5. local function unfloatCharacter(character)
  6.     local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
  7.     if humanoidRootPart then
  8.         local bodyVelocity = humanoidRootPart:FindFirstChild("BodyVelocity")
  9.         if bodyVelocity then
  10.             bodyVelocity:Destroy()
  11.         end
  12.     end
  13. end
  14.  
  15. local function flingCharacter(character)
  16.     local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
  17.     if humanoidRootPart then
  18.         local bodyVelocity = humanoidRootPart:FindFirstChild("BodyVelocity")
  19.         if not bodyVelocity then
  20.             bodyVelocity = Instance.new("BodyVelocity")
  21.             bodyVelocity.Velocity = Vector3.new(0, 7, 0) -- Adjust the values as needed
  22.             bodyVelocity.MaxForce = Vector3.new(0, math.huge, 0)
  23.             bodyVelocity.Parent = humanoidRootPart
  24.         else
  25.             bodyVelocity.Velocity = Vector3.new(0, 7, 0) -- Adjust the values as needed
  26.         end
  27.     end
  28. end
  29.  
  30. tool.Activated:Connect(function()
  31.     if tool.Name == "Float" then
  32.         tool.RequiresHandle = false -- Allow multiple uses without needing to re-equip the tool
  33.         tool.Name = "Unfloat"
  34.        
  35.         local character = game.Players.LocalPlayer.Character
  36.         if character then
  37.             while tool.Name == "Unfloat" do
  38.                 flingCharacter(character)
  39.                 wait()
  40.             end
  41.         end
  42.     else
  43.         tool.RequiresHandle = true -- Set back to true to prevent continuous activation
  44.         tool.Name = "Float"
  45.        
  46.         local character = game.Players.LocalPlayer.Character
  47.         if character then
  48.             unfloatCharacter(character)
  49.         end
  50.     end
  51. end)
  52.  
  53. tool.Parent = game.Players.LocalPlayer.Backpack
Add Comment
Please, Sign In to add comment