# How can I make a part unaffected by gravity?

Hey there, i am trying to make a part that is completely unaffected by gravity, but I am having issues.

The old method of removing gravity from a part (creating a body/vector force that is equivalent to the workspace’s gravity * the part’s mass on the y axis) seems to not work anymore, I have tried multiple variations of it but to no avail. the part just always flys away

9 Likes

Probably not of any help but don’t parts have a new Massless property? Can’t you use that?

2 Likes

No, for some reason the massless property doesn’t effect the part’s gravity, although that’d be incredibly useful

6 Likes

Using a body mover/vector force is the only solution atm (I’d suggest vector force). Could you provide some context to the situation so we can figure out what is causing it to fly off? My guess is the part’s velocity is already set to something before you add the vector force. This would just cause the part to move in that direction forever. If you want to make sure it doesn’t move when you add the vector force, try setting Velocity and RotVelocity to Vector3.new(0,0,0)

1 Like

No, I set the velocity to a vector 3 of 0,0,0 after making the anti gravity force

Massless is just for mechanisms where the root part has a mass, the connected parts with Massless true don’t add to the total mass, e.g. bodykit for a car where you don’t want it to affect the handling.

1 Like

The usual method that uses a BodyForce works for me; perhaps you’ve done it incorrectly. Could you try inserting this Script into the Part to see if it works as expected?:

``````local parent = script.Parent
local bodyForce = Instance.new("BodyForce")
bodyForce.Force = Vector3.new(0, parent:GetMass() * workspace.Gravity, 0)
bodyForce.Parent = parent
``````
16 Likes

When I was working on solving a problem with establishing a way a player could be made to go up and down via q and z keys and hover when required I had to add a variation on the mass * gravity setting.
The variation I used was to multiply the calculation by 0.999972 and discovered by experimentation.
I have just tried the rbxl I created and its still works fine and the hover is stable for my specific setup.

1 Like

it did not work, as i stated earlier this is exactly what i tried, but nonetheless i still inserted this script, and still the part flew away

Is there anything else altering properties of the Part? Does gravity change mid-game?

Do you have customPhysical Properties Enabled?

Anchoring means that the object is no longer affected by anything, and from what I can tell, he wants it affected by everything but gravity, so it’s not an option.

2 Likes

Gravity stays constant

No, i do not have customphysicalproperties enabled

Can you send us a visual of the part flying off?

That problem is probably if not definitely the issue of the humanoid. It’s his head. I haven’t had issues with this so I can’t really help out with this.

Try using a body velocity.

``````local bv = Instance.new("BodyVelocity")
bv.Velocity = Vector3.new(0,0,0)
bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)--Play around with this
bv.P = 9000--Play around with this
bv.Parent = part
``````

Hope I could help.

22 Likes

See this post

1 Like