Advertisement
Descaii

Antigrav

Mar 31st, 2015
361
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.93 KB | None | 0 0
  1. local GetRecursiveChildren=function(P)
  2.     local n,t,G={},table.foreach
  3.     function G(c,p)table.insert(n,p)t(p:GetChildren(),G) end
  4.     t(P:GetChildren(),G)
  5.     return n
  6. end
  7. function c(n)for i,v in pairs(game.Players:GetPlayers())do if n:IsDescendantOf(v.Character)then return end end return true end
  8. function ag(v)
  9.     if pcall(function()v:GetMass()end)and v.Name~="Base"and v~=Workspace.Terrain and c(v)and(function()if v:findFirstChild("BodyForce")then v.force:Destroy()return true end end) then
  10.         local f=Instance.new("BodyForce",v)
  11.         f.force=Vector3.new(0,v:GetMass()*196.2,0)
  12.         f.Changed:connect(function()f.force=Vector3.new(0,v:GetMass()*196.2,0)end)
  13.         v.Changed:connect(function()f.force=Vector3.new(0,v:GetMass()*196.2,0)end)
  14.         v.Anchored=false;v:breakJoints()
  15.         v.DescendantAdded:connect(function()ag(v)end)
  16.     end
  17. end
  18. table.foreach(GetRecursiveChildren(Workspace),function(i,v)ag(v)end)
  19. Workspace.DescendantAdded:connect(function(v)ag(v)end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement