Can anyone tell me why this SurfaceGui tool giver gives me this error?
Workspace.ClickPart.SurfaceGui.Button.:2: attempt to index local 'playerWhoClicked' (a nil value)
Here is the code:
function givetool(playerWhoClicked)
if playerWhoClicked:GetRoleInGroup(1) >= 6 and playerWhoClicked.TeamColor == BrickColor.new("Brown") then
local toolclone = game.ServerStorage.TestTool:Clone()
testtool.Parent = playerWhoClicked.Backpack
else
print("Unauthorized request!")
end
end
script.Parent.MouseButton1Click:connect(givetool)

1 comment
Thanks.