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

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

Asked by 5 years ago

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?

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 Rare_tendo 3000 — 5y
0
The server cannot access the LocalPlayer property of the Players service. User#25115 0 — 5y
0
^ Technically, it can, but it'll be nil Rare_tendo 3000 — 5y
0
That's what I meant, but ok. User#25115 0 — 5y

1 answer

Log in to vote
0
Answered by
Creacoz 210 Moderation Voter
5 years ago

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

Ad

Answer this question