Why does my orbital gravity script only pull one object at a time?
local objects = workspace.Objects
while wait() do
local G = 6.67430 * 10 ^ -11
for x, object in pairs(objects:GetChildren()) do
for y, otherObject in pairs(objects:GetChildren()) do
if otherObject ~= object then
r = otherObject.CFrame.p - object.CFrame.p
F = G * object:GetMass()+otherObject:GetMass() / r.Magnitude ^ 2
object.BodyForce.Force = F * r.Unit
end
end
end
end
