a=game.Workspace.Holo.config b=a.RankId c=a.GroupId game.Players.PlayerAdded:connect(function(plr) if plr:GetRankInGroup(c.Value) >= b.Value then plr.Chatted:connect(function(msg) if string.lower(msg) == "sf" then game.Lighting.Thing:Clone().Parent = game.Workspace elseif string.lower(msg) == "close sf" then if game.Workspace:FindFirstChild("Thing") then game.Workspace.Thing:Remove() end end end) end end)
Says Workspace.Holo:5: attempt to index global 'player' (a nil value)' what am I doing wrong?This might be the last problem to my script
I've already answered this.
Your function gets a variable called plr
on line 4.
You then decide on line 5 to use a variable called player
that hasn't come from anywhere. Since the argument is named plr
, you have to use plr
when you are referring to it.
On line 6 you use yet another name (Player
-- names are case sensitive).
Use plr
everywhere since that's what you decided to call it in the parameter.
The same goes for chat
and msg
. You're using chat
but it doesn't come from anywhere! You decided to call it msg
, you have to stick with that.
Locked by adark and evaera
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?