local children = script.Parent.Parent:GetChildren()
local mass = 0
for i = 1, #children do
if children[i]:IsA("Part") then
mass = mass + children:GetMass()
end
end
local forcemover = script.Parent.WaterForce
forcemover.force = Vector3.new(0, 196.2, 0) * mass
in theory this should have worked but im not sure what went wrong.
@mantorok4866 What do you mean with float. Should it move up and down or fly un-anchor in the world? If I know what you mean I could help you.
the goal is to have it counter gravity to were its weightless, the player or anything else could push it in any direction and it would float around as if in space.
I’m not sure if this would work, but I did notice a error in your code. You call :GetMass() on the array, so you add too much mass to the mass variable. Try this:
local children = script.Parent.Parent:GetChildren()
local mass = 0
for i = 1, #children do
if children[i]:IsA("Part") then
mass = mass + children[i]:GetMass() --children[i] instead of children
end
end
local forcemover = script.Parent.WaterForce
forcemover.force = Vector3.new(0, 196.2, 0) * mass
1 Like
I should also mention if I use this code on a single ungrouped part:
local forcemover = script.Parent.WaterForce
local part = script.Parent
forcemover.force = Vector3.new(0, 196.2, 0) * part:GetMass()
the part will float around the same way I want the model to float around.