Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I change the walk speed of the player?

local LocalPlayer = game.Players.LocalPlayer
LocalPlayer.Character.WalkSpeed = game.ReplicatedStorage.Points.Value + 3

'Attempt to index local 'LocalPlayer' (a nil value)'

3 comments

0

I suggest you use a Script, if you are using FilteringEnabled, LocalScripts are not supposed to be doing this.

0

I am using a script in server script service

0

ServerScriptService can't access "LocalPlayer", that can only be accessed by LocalScripts

2 answers

✓ Accepted answer

I don't know how you want to increase the player's speed, for example it happens when you touch a brick or a key bind. Since you're using a server script, you're trying to access the LocalPlayer, but that's only available through local scripts, not server. Either you can put your original code in a local script, or you can do this:

game.Players.PlayerAdded:Connect(function(plr)--This happens whenever a player joins
	
	local char = plr.Character or plr.CharacterAdded:Wait()--Gets player's character
	local hum = char.Humanoid
	hum.WalkSpeed = game.ReplicatedStorage.Points.Value + 3

end)

This code goes in a normal script. Put this script in ServerScriptService. I also noticed you're trying to set the WalkSpeed from the character. It's the character's humanoid that you do this to, not the actual character.

local localPlayer = game.Players.LocalPlayer
localPlayer.Character.Humanoid.WalkSpeed = game.ReplicatedStorage.Points.Value + 3

You were using the local as "LocalPlayer"

so it diden't know what to use. , also you need to use a Humanoid

2 comments

0

Also are you using it in a LocalScript?

0

This didn't work same error message

This discussion is preserved as it was. New answers, comments, and votes are closed.