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

Help with FireServer throwing "Atempt to index a nil value"?

I have a localscript inside of StarterPlayerScripts that fires a remote event under a script when the player's humanoid dies.

game.ServerScriptService.HPincreaseGiver.RemoteEvent:FireServer()

It works in the Studio test but when the game is run on the Roblox servers it gives this error

"Players.XXXlawsonXXX.PlayerScripts.LocalScript:4: attempt to index a nil value"

1 answer

✓ Accepted answer

The reason why is that the client can't see things in the ServerScriptService. This is quite a common mistake. Move the HPincreaseGiver to ReplicatedStorage and change the firing code to

game.ReplicatedStorage.HPincreaseGiver.RemoteEvent:FireServer()

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