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

Color issues with NPC?[Solved]

Asked by 9 years ago

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)
0
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. Tempestatem 884 — 9y
0
I already tried that, idk why but the whole script stops working when i ask it to find script.Parent.Parent.Parent.TeamColor BSIncorporated 640 — 9y
0
Try and change their colors through the Body Color objects. That should work. Redbullusa 1580 — 9y

1 answer

Log in to vote
-1
Answered by
yoshiegg6 176
9 years ago

s.BrickColor = BrickColor.Red()

It should be

s.BrickColor = BrickColor.new("ReallyRed")

0
Same thing with green. yoshiegg6 176 — 9y
0
BrickColor.Red() is a object...there are a few colors you dont have to spell out. Also, "ReallyRed" wont work. it would be "Really Red" with a space BSIncorporated 640 — 9y
0
I made it clear where my issues were, there is nothing wrong with this script, i just couldnt add something to it. I made a seperate script for this. BSIncorporated 640 — 9y
Ad

Answer this question