Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago

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

Log in to vote
2
Answered by
Griffi0n 315 Moderation Voter
6 years ago

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()
Ad

Answer this question