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

Developing a game, this error won't go away. Any help?

I am developing a game, and I'm trying to add a tag to your player that displays how much money you have, so the game can read that, and if you have a certain amount of rebirths you can go through a door.

Here's what I got.

	local Workspace = game:GetService("Workspace")

	local Players = game:GetService("Players")
	
	local Name = Players.LocalPlayer.Name
	
    local Humanoid = script.Parent:WaitForChild("Humanoid")
	
	
	local Tag = Instance.new("NumberValue")
	Tag.Name = "Tag"
	Tag.Parent = Workspace.Name
	
	print(" name is" ..game.Workspace[Name].Tag.Value ..".")

but, it says localplayer is a nil value, can anyone help with that?

4 comments

0

The server doesn't have its own local player - LocalPlayer will always be nil on the server. You're gonna need to use a Player added event

0

The server cannot access the LocalPlayer property of the Players service.

0

^ Technically, it can, but it'll be nil

0

That's what I meant, but ok.

1 answer

It is doing the error because you can not use LocalPlayer in a normal script. It would work in a LocalScript. Sorry!

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