If you have a button with a CLickDetector, and you only want rank+ or team only, or something to use it, how do I find the player from the click to check if the person is rank+, team, etc?
I know I need something like this...
script.Parent.ClickDetector.MouseClick:connect(function() --*something to find the player* if Player.TeamColor == BrickColor.new("Really red") then script.Parent:Remove() end end)
All you need to edit is :
script.Parent.ClickDetector.MouseClick:connect(function(Player) --The Player is already there the MouseClick function actually gets the player, you just needed to add in the parameter for them. --You don't need anything to find the player, but verifying them would be good. if game.Players:FindFirstChild(Player.Name) then if Player.TeamColor == BrickColor.new("Really red") then script.Parent.remove() end end end)
Hope that helped.
I don't understand what you mean by "find," so this is the closest I can think of.
script.Parent.ClickDetector.MouseClick:connect(function(Player) if Player:GetRankInGroup(GROUPID) >= RANKNUMBER and Player.TeamColor == BrickColor.new("Really red") then print(Player.Name.. "clicked the button") script.Parent:Remove() end end)