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

My problem defining plr? The script is for a clicker based game.

Here is the code output says is wrong :

Output says "plr is not a valid member of Players"

local plr = game.Players("plr")

Robux.MouseButton1Click:connect(function() plr.leaderstats.Robux.Value = plr.leaderstats.Robux.Value + value.Value end)

I'd like the script to work on only that player.

I can send the whole code but its 90 lines.

I am confused. Im new to lua.

I looked at a few ways to fix it, but now I have just killed it. The game is like cookie clicker just different.

Thanks -GG

2 answers

If this is in a localscript:

local plr = game.Players.LocalPlayer

If this is not in a localscript:

local plr = game.Players:FindFirstChild("PLAYER NAME HERE")

**What you were doing wrong is leaving out 'FindFirstChild' **

Thanks for the answer, but if I want the script to find the scripts owner (player). How would I make this work with a server of people?

local plr = game.Players:FindFirstChild("PLAYER NAME HERE")

Will that work for every player? Or will it work for all players?

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