Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local GetRecursiveChildren=function(P)
- local n,t,G={},table.foreach
- function G(c,p)table.insert(n,p)t(p:GetChildren(),G) end
- t(P:GetChildren(),G)
- return n
- end
- function c(n)
- for i,v in pairs(game.Players:GetPlayers())do
- if n:IsDescendantOf(v.Character)then
- return
- end
- end
- return true
- end
- function ag(v)
- 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
- local f=Instance.new("BodyForce",v)
- f.force=Vector3.new(0,v:GetMass()*196.2,0)
- f.Changed:connect(function()
- f.force=Vector3.new(0,v:GetMass()*196.2,0)
- end)
- v.Anchored=false;v:breakJoints()
- v.DescendantAdded:connect(function()ag(v)end)
- end
- end
- table.foreach(GetRecursiveChildren(Workspace),function(i,v) ag(v) end)
- Workspace.DescendantAdded:connect(function(v) ag(v) end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement