I am trying to make a 0 gravity game and I already handled the player's 0 gravity script, but I can't seem to make parts float around, whenever I play they always fall to the ground. I haven't tried any scripts for it, instead I was trying to change properties like density and mass to make it float, but none of that worked, although if that is the solution I probably got the numbers wrong.
COMMUNITY QUESTION
How do I make a part float around while gravity is 0?
1 answer
Nevermind I figured it out! If you want to see the code for it,
local object = script.Parent;
local bodyForce = Instance.new("BodyForce", object) -- Creating a BodyForce.
local mass = object:GetMass();
local gravity = workspace.Gravity;
bodyForce.Force = Vector3.new(0, 0, 0) -- Setting the force to have no impact at the moment I create it.
function set_Powers(mass, gravity)
bodyForce.Force = Vector3.new(0, mass * gravity, 0)
end;
while wait() do
set_Powers(mass, gravity)
end
This discussion is preserved as it was. New answers, comments, and votes are closed.
