local green = game.Workspace.green:GetChildren() function onClicked(plr) -- On click get player if green.PLRNAME == plr.Name.Value then script.Parent.Parent:Destroy() end end script.Parent.ClickDetector.MouseClick:Connect(onClicked)
the below is an answer repost(i wrote an answer to ur original question but u idk if u saw it so here is a repost):
ok so what im guessing is either
local green = game.Workspace.green -- i altered this part a bit function onClicked(plr) -- On click get player if green.PLRNAME == plr.Name.Value then script.Parent.Parent:Destroy() end end script.Parent.ClickDetector.MouseClick:Connect(function(plr) -- i also altered this part onClicked(plr) end)
or that
local green = game.Workspace.green -- i altered this part a bit function onClicked(plr) -- On click get player if green.PLRNAME == plr.Name then -- i also altered this part a bit script.Parent.Parent:Destroy() end end script.Parent.ClickDetector.MouseClick:Connect(function(plr) -- i also also altered this part onClicked(plr) end)
i apologize if this dusnt work ur question is also too broad btw
You are assigning it to the value instance but not its Value property. Change line 4 to this:
if green.PLRNAME.Value == plr.Name then
Assigning it to the StringValue is assigning it to the Instance, not the actual string that makes up the value. This is a very simple mistake many people make.