The following script makes everything weightless--cylinders, spheres, blocks, but for some reason does not affect wedges. What changes could be made so that they, too, are affected by the script?
local Factor = 196.2
function AddGravity(Part)
local Gravity = Part:findFirstChild("BodyForce")
if Gravity ~= nil then
return
end
local Gravity = Instance.new("BodyForce")
Gravity.Parent = Part
Gravity.force = Vector3.new(0,Factor * Part:GetMass(),0)
end
function GetClass(Root)
if Root.className == "Part" or Root.className == "Seat" or Root.className == "SpawnLocation" or Root.className == "FlagStand" then
AddGravity(Root)
end
local Parts = Root:GetChildren()
for X = 1, # Parts do
GetClass(Parts[X])
end
Root.ChildAdded:connect(function(Child)
GetClass(Child)
end)
end
GetClass(script.Parent) |