• Dear Guest,

    You're browsing our forum as a Guest meaning you can only see a portion of the forum in read-only mode.
    To view all forum nodes and be able to create threads/posts please register or log-in with your existing account.

    TwinStar team

Check if target is a player

tristan

Authorized
Joined
Oct 26, 2014
Location
Chile
Hello fellow players,
I'm working on some scripts and I would like to ask for your help again!

I wanted to ask if you know any effective code that can identify if your current target is an actual player, and not an NPC.
And, if you know too, a code that can identify if a "frame" belongs to a player too, such as the ones you obtain with this code:
Code:
local frames = {WorldFrame:GetChildren()}


Thank you very much in advance.
 
Hagson already answered your first question.

Players have unique names (i.e. there are no 2 players with the same name), so if you iterate WorldFrame:GetChildren(), you will get all the nameplates visible. Every nameplate stores its name (player's name). So, if you want to know if a frame (nameplate) belongs to a player, compare their names.
 
Top Bottom