BodyForce Gravity not working

robloxapp-20210331-1207482.wmv (1,2 MB) like this

This script should work fine:

local part = script.Parent
local bodyForce = Instance.new(“BodyForce”)
bodyForce.Parent = part
local bodyForce.Force = Vector3.new(0, part:GetMass() * workspace.Gravity, 0)

no is giving aan error Syntax error, Got

Hi! You would check out this, Wall stick/Gravity Controller

Give credits to their owner, @EgoMoose.

Here is [Example Source] Smooth Wall-Walking "Gravity Controller" from Club RAVEN by @EmilyBendsSpace.

hey, i don’t to download/ use models. i want to learn

1 Like

hey, sorry, I messed up with the code I wrote earlier, you can try this:

local part = script.Parent
local bodyForce = Instance.new(“BodyForce”)
bodyForce.Parent = part
part.BodyForce.force = Vector3.new(0, part:GetMass() * 196.2, 0)

1 Like

local part = script.Parent
local bodyForce = Instance.new(“BodyForce”)
bodyForce.Parent = part
local bodyForce.Force = Vector3.new(0,
part:GetMass() * workspace.Gravity)

Would work fine I think.

1 Like

nothing, not work, and i don’t know why :confused:

Try this one:

local part = script.Parent
local force = Instance.new("BodyForce")
force.Parent = script.Parent
force.Force = Vector3.new(0,part:GetMass()*workspace.Gravity,0)
1 Like

no, but i insert those script in the Part, is correct?

Yeah you should insert this in the Part. Also this will not work in anchored parts

If you want this to work in models, you have to calculate the total mass of the model (All the parts inside it).

ohhh thats (maybe) why, let me try

1 Like

robloxapp-20210331-1234182.wmv (2,2 MB)

So, are you trying to make the part float in mid-air, but without changing the world gravity or are you trying to make a wall walking gravity controller?

yes, i posted a video of what i needrobloxapp-20210331-1207482.wmv (1,2 MB)

EgoMoose already made a post on this, you can click here for more help: Wall stick/Gravity Controller

1 Like

But it’s the same as above … However I don’t use stuff from GitHub

It’s not easy to do what egomoose is doing there - he’s not just applying a force, he’s doing all sorts of hidden stuff behind the scenes to make it seem like you’re stuck to a wall when you’re really not.

A sort I would say, but i see is not easy, pity I wanted to learn

Yeah, there is no quick way to do this. You have to write a complete replacement for Roblox character controller because anything with a Humanoid in it has a non-defeatable BodyGyro trying to keep it upright when in the Running state. And for doing it smoothly, the math is not trivial; you have to have a good understanding of matrix algebra, vector math, and linear time-invariant control systems.

3 Likes