So, I'm making a tool and I'm trying to figure out how to get a players name and what team they're in
How the tool works is you would click the person you want to scan and it will display their name and depending on what team they are in it will display a certain message
The whole displaying bit I can do I just want some help with the whole finding player and all that.
Thanks
you can use the Button1Down
event of the players mouse and use a generic for loop
to loop through all the players and check if the target is them.
ex
--client local player = game.Players.LocalPlayer local tool = script.Parent -- lets say this was the tool tool.Equipped:Connect(function(mouse) mouse.Button1Down:Connect(function() -- when the players clicks then if mouse.Target then for _,v in pairs(game.Players:GetPlayers()) do -- literate through all the players if mouse.Target.Parent == v.Character then print(v.Name, v.TeamColor) -- prints the name and teamcolour of the player break -- breaks the loop end end end end) end)