local LocalPlayer = game.Players.LocalPlayer
LocalPlayer.Character.WalkSpeed = game.ReplicatedStorage.Points.Value + 3
'Attempt to index local 'LocalPlayer' (a nil value)'
local LocalPlayer = game.Players.LocalPlayer
LocalPlayer.Character.WalkSpeed = game.ReplicatedStorage.Points.Value + 3
'Attempt to index local 'LocalPlayer' (a nil value)'
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
Also are you using it in a LocalScript?
This didn't work same error message
This discussion is preserved as it was. New answers, comments, and votes are closed.
3 comments
I suggest you use a Script, if you are using FilteringEnabled, LocalScripts are not supposed to be doing this.
I am using a script in server script service
ServerScriptService can't access "LocalPlayer", that can only be accessed by LocalScripts