im trying to change the players gravity locally by using bodyforce.
However, when the script runs no bodyforce is being added to the bodyparts.
local player = game.Players.LocalPlayer
local bodyForce = Instance.new("BodyForce")
for _, bodyPart in ipairs(player.Character:GetDescendants()) do
if bodyPart:IsA("BasePart") then
bodyForce.Force = Vector3.new(0, bodyPart:GetMass() * 50 * workspace.Gravity, 0) -- The force required to simulate gravity on the moon
bodyForce.Parent = bodyPart
end
end
local player = game.Players.LocalPlayer
for _, bodyPart in ipairs(player.Character:GetDescendants()) do
if bodyPart:IsA("BasePart") then
local vectorForce = Instance.new("VectorForce")
vectorForce.Force = Vector3.new(0, bodyPart:GetMass() * 50 * workspace.Gravity, 0)
vectorForce.ApplyAtCenterOfMass = true
vectorForce.RelativeTo = Enum.ActuatorRelativeTo.World
vectorForce.Parent = bodyPart
end
end