game.Workspace.Gravity not changing in game

Hi!
In my game I am working on, the players can purchase low gravity for the rounds, my issue is that the gravity is not changing…

image

The thing is, that the “gravity changed to 20” prints, which means the bool in the function is true.

So why isn’t the gravity changing?
It just stays on the original 196.2 gravity.

This is in a server script.

Try changing it to a local script and see if it makes a difference.

No, they want to change it for everyone. And I don’t believe changing the gravity from a local script even works.

try doing @iloveyoutube4474

workspace.Gravity = true and 20

that doesn’t seem to do anything either…

try putting it to

workspace.Gravity = false and 20

mabye? I might of had it the other way, the server script is in ServerScriptService right?

1 Like

didn’t work either.

and yes the script is in ServerScriptService.

Somethings:

  • Gravity updates for the clients if you change it on the server so it should affects everything
  • If you set the gravity on the client you can change the gravity for a single player (which affects all the stuff they have network ownership of, like characters), though the OP wants everyone’s gravity to change
  • true and 20 is the same as 20 and false and 20 is the same as false

Your code should work, try looking at the gravity in the properties window while the game is running. I’m pretty sure some other code is changing the gravity back to the default.

If the gravity is incorrect in the properties window, try adding print statements to section of you code that set the gravity back to the default and see which is causing the problem.

1 Like

It would work changing it from a local script. I’ve done it before. But as you said, you want it to change for everyone so a local script is out of mind.

1 Like

I’m not even the question owner :expressionless:

1 Like

I know, still wanted to mention it though :expressionless:

1 Like

I feel so silly now haha.
Turns out another script I have kept changing it back!

Thanks to everyone for your help.

1 Like