Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I make an NPC detect the BrickColor of the player's torso?

Asked by 3 years ago
Edited 3 years ago

Hey everyone. What I'm trying to make it's so like the NPC evaluates the player torso's BrickColor for it add to the "allies" array. It doesn't seems to function but it doesn't results on an error either. I've trying to figure a way to do this.

Edit: I'm using R6 rigs for they are easier to work with

Here's the code:

game.Workspace.ChildAdded:Connect(function(char)
    if char.Name == game.Players:FindFirstChild(char.Name) then
        if char.Torso.BrickColor == BrickColor.new("Bright blue") then
             table.insert(allies,char.Name)
        else
        end
    end
end)

If there's something I haven't seen or a better way to achieve this, please leave it on the comment section. All feedback is appreaciated.

0
Are your rigs R6 or R15? You used "Torso" instead of "Upper Torso" or "Lower Torso". ResDXsention 108 — 3y
0
Or just apply a NumberValue or StringValue to the player's character to designate their team -- the torso color can be handled separately. ResDXsention 108 — 3y
0
I'm using R6 rigs jefelocaso 0 — 3y

Answer this question