Help with gravity affecting parts

I’m having one of those problems, where the effect worked before but doesn’t work anymore although nothing was changed scenarios.

My problem:
When the slow motion is enabled all the parts move slowly (That works perfectly) but when I turn off slow motion they still keep the same gravitational force although 10 minutes later is was working both ways.

If you have any advice it would be appreciated, thank you.

coroutine.wrap(function()
	while wait() do
		Character.HumanoidRootPart.Velocity = Vector3.new(Character.HumanoidRootPart.Velocity.X,-1,Character.HumanoidRootPart.Velocity.Z)
		if Humanoid.MoveDirection.Magnitude > 0   then 
			game.Workspace.Gravity = 196.2
			Slow.Value = false
		else
			Slow.Value = true
			game.Workspace.Gravity = 5
		end
	end
end)()

Also There is a solution by putting it into a server script, but that also means the off and on gets affected by lag.

So in the while loop where you decide the player has stopped moving you may need to flag that as the next cycle the player could still be moving under the gravity 5 and so the players magnitude would be greater than 0.
Maybe you need a timeForSlowWorking value that is checked in the Magnitude >0 check and if not 0 then decrease it until it is and then do the gravity reset to normal.
I may not have described it well but I hope you get my drift.

My bad, I just switched to a server script to fix the problem, it wasn’t really anything with the script itself, I just found it weird that it was working on the client beforehand and then it didn’t work. Thanks though,

1 Like