Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player = game.Players.LocalPlayer
- local char = player.Character or player.CharacterAdded:Wait()
- local mouse = player:GetMouse()
- function toggleGravityForModel(model,off)
- for i,v in pairs(model:GetDescendants()) do
- if v:IsA("BasePart") and off then
- local f = Instance.new("BodyForce")
- f.Name = "GravityThing"
- f.Force = Vector3.new(0, game.Workspace.Gravity * v:GetMass(),0)
- if not v:FindFirstChild("GravityThing") then
- f.Parent = v
- else
- f:Destroy()
- break
- end
- elseif not off and v:IsA("BasePart") and v:FindFirstChild("GravityThing") then
- v:FindFirstChild("GravityThing"):Destroy()
- end
- end
- end
- mouse.Button1Down:Connect(function()
- toggleGravityForModel(char,true)
- end)
- mouse.Button2Down:Connect(function()
- toggleGravityForModel(char,false)
- end)
Advertisement
Add Comment
Please, Sign In to add comment