I’m trying to be able to save the player’s current walkspeed through a variable in a server-sided script so that I can use it later when I change the walkspeed, though I’m not really sure at how to go at it.
you could simply set a variable as the walkspeed before changing it.
local player local walkspeed = player.Character.Humanoid.WalkSpeed player.Character.Humanoid.WalkSpeed = 200 task.wait(1) player.Character.Humanoid.WalkSpeed = walkspeed
Yes I tried a method similar to that before, but for some reason it only saves the default walkspeed, not any other walkspeed.
I’m going to assume you change the walkspeed in a local script, and are trying to save the walkspeed on a server script to use later. Am I correct?
Yeah, I created a local script in the StarterCharacterScripts that changes the walkspeed.
Then that’s the problem. The client changes the walkspeed, but the server cannot see that. So, when trying to save the walkspeed on the server, the server will view it as the default walkspeed and save that instead.
Thanks, I didn’t know about that, how should I make it so that the server can see the walkspeed? Do I turn the local script into a server-sided script?
It depends on the contents of the local script. If the local script handles something locally and the server can’t handle that, it isn’t possible to convert it to a server script. What does the local script do?
Well it handles basically the walkspeed, and there’s a function in there that changes the walkspeed when the player is lower on health.
Then the script should be fine to convert into a local script, just changing the way it is handled. Where is the local script? I would recommend changing it into a server script, putting it into ServerScriptService, and making it able to handle all players instead of just one player.