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

The Holo? again .-. I have tried lots of things[SOLVED] [closed]

Asked by 9 years ago
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

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?

1 answer

Log in to vote
2
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
9 years ago

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.

0
I have updated my script have I done something wrong now? Ex_plore 62 — 9y
0
I mean like is there anything else wrong? Ex_plore 62 — 9y
0
THANK YOU SO MUCH! Ex_plore 62 — 9y
Ad