How to tell if a humanoid is a player or a character

I am making a turret, and trying to make different settings for what it can attack, How do i tell if a humanoid is a NPC or a player to decide whether it should be targetted or not?

local char = humanoid.Parent
local player = game.Players:GetPlayerFromCharacter(char)

if player then
 -- Then do stuff
end
1 Like

Exactly what i was looking for, thank you!