I have a localscript inside of StarterPlayerScripts that fires a remote event under a script when the player's humanoid dies.
1 | 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"
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
1 | game.ReplicatedStorage.HPincreaseGiver.RemoteEvent:FireServer() |