Changing gravity for only one player

How would I change the gravity for only one player? My game is a game where you can go to the moon when you get to the moon your gravity is supposed to change so that it feels like you are on the moon. I have tried messing around with Workspace.Gravity, but I have not found a way to make it only change for one or several players.

7 Likes

You may just use a LocalScript and set the player to be game.Players.LocalPlayer

2 Likes

I don’t understand, the Gravity property is in Workspace.

Is the Gravity Property an IntValue?

Yes. 30 charssssssssssssssssss

1 Like

Its better to place the IntValue in The StarterGui as it is only ClientSide. So you could set the value of it through a LocalScript.
To Access the it when the game has run do game.Players.LocalPlayer.PlayerGui.Gravity

Though it is better to just make it a boolen value inside of a localscript

Add a BodyForce to the HumanoidRootPart of the players character that exerts a certain force on the Y Axis, Higher the Y, lower the gravitational pull, lower the Y, Higher the gravitational pull

2 Likes

To change the gravity locally you just have to change workspace.Gravity in a LocalScript. Switch the region checking (“is the player on the moon?”) to the client as well or use RemoteEvents to change the gravity.

If an IntValue in workspace changes through a localScript will it only change for the client?

This post has nothing to do with IntValues, and regardless, it would be a major security flaw if changing Values on the client would replicate to the server.

Where is the IntValue coming from, this is a property

He said that Gravity was an IntValue in Workspace

I think upon seeing this post i got incredibly confused and started questioning my own scripts

I don’t think you are understanding the whole point of the discussion, consider re-reading it,

Im pretty sure you cant do that, BodyForce is the usual way I do it

I think im overthinking this since he can just use a localscript

You can change gravity on the client side and it will only affect that one player.

Simply write in a local script:
game.Workspace.Gravity = x

2 Likes

Yes, although I would still go for BodyForces. They are more under control and you can use them to apply any amount of force in any direction. You can’t use workspace.Gravity to reverse the force anyhow,

Adding another point: You can use them server sided too, that disregards the use of remote events.

2 Likes

I disagree for this use case, OP says that he wants the gravity to feel like the moon, BodyForces seem a little overkill compared to just changing the gravity locally.