local gravity = game.Workspace.Part.SpecificGravity
gravity = .9999999999999
end
This is not working for me and I don't know why. Can someone help?
local gravity = game.Workspace.Part.SpecificGravity
gravity = .9999999999999
end
This is not working for me and I don't know why. Can someone help?
First off, you need a BodyForce. Put that into the brick, and then edit the force so that X and Z are both 0, but Y is the number you need to counteract the gravity of the brick.
ROBLOX's gravity is about 196.2 studs/second^2. Just like Earth's gravity is 9.81 meters/second^2
The gravity of a brick is measured by its volume. So to find the volume of the Brick, simply multiply its Length by its Width by its Height: Part.Size.X * Part.Size.Y * Part.Size.Z
Finally, you have to counter the gravity of the brick, so you have to multiply the volume of the brick by ROBLOX's gravitational acceleration, and you get this: Part.Size.X * Part.Size.Y * Part.Size.Z * 196.2.
Once you have all that done, just put edit the BodyForce's force, like so:
local BodyForce = script.Parent.BodyForce
local Part = script.Parent
BodyForce.force = Vector3.new(0,Part.Size.X * Part.Size.Y * Part.Size.Z * 196.2,0)
Hope this helped!
This discussion is preserved as it was. New answers, comments, and votes are closed.
5 comments
You cannot edit the SpecificGravity property, and what is the purpose of your 'end' in line 5?
I don't know but I that is what you do. I am new at scripting and I want to make it almost float so that would b really helpfull if someone knew how.
Use a BodyForce, BodyPosition, or BodyVelocity object.
Well, in this code, you're not even attempting to set the Part's SpecificGravity, even though it's a locked property. What you're actually doing is setting the gravity variable to .999.. The best way to make a part float, is to just Anchor it.
Look up "hover bricks" in free models, and analyze how they work. I'm willing to bet that (the working ones) will be very similar to what you're trying to code; examining already created code is one of the most beneficial things to do for beginners.