I'm making a script that allows a player to place a minion type thing, and I want the arm colors of the NPC to change to the player's team color. Any ideas? This is the script:
wait()
local s = script.Parent.Selection
local p = script.Parent.Model
local canplace = false
local selected = false
local pos = Vector3.new(0,0,0)
script.Parent.Selected:connect(function(mouse)
selected = true
player = script.Parent.Parent.Parent
s.Parent = player.Character
mouse.Button1Down:connect(function()
if canplace then
--this is where it needs to find the team color and apply it to the NPC
s:Remove()
p.Parent = game.Workspace:FindFirstChild(player.Name)
p:MakeJoints()
script.Parent:Remove()
end
end)
while wait() do
if not selected then return false end
pos = Vector3.new(math.floor(mouse.Hit.p.X),math.floor(mouse.Hit.p.Y),math.floor(mouse.Hit.p.Z))
s.Position = pos+Vector3.new(0.5,0,0.5)
part,pos = workspace:FindPartOnRay(Ray.new(s.Position,Vector3.new(0,-0.2,0)),player.Character)
if part and part.BrickColor ~= BrickColor.Black() then
canplace = true
s.BrickColor = BrickColor.Green()
else
canplace = false
s.BrickColor = BrickColor.Red()
end
end
end)
script.Parent.Deselected:connect(function(m)
selected = false
s.Parent = script.Parent
end)

3 comments
What I would do is, find the color via the TeamColor property of the player, then set the arms BrickColor to whatever the TeamColor is.
I already tried that, idk why but the whole script stops working when i ask it to find script.Parent.Parent.Parent.TeamColor
Try and change their colors through the Body Color objects. That should work.