ZelphurxJoin Date: 2012-12-15 Post Count: 534 |
I am somewhat new to scripting.
I made a script that gives me a black head. However, I want to know if there is a way to use a varient of this to give an entire team a black head. This is the original one:
workspace.ChildAdded:connect(function(child)
if child:IsA("Model") and child.Name == "Zelphurx" then
child:WaitForChild("Body Colors")
child["Body Colors"].HeadColor = BrickColor.new("Really black")
end
end)
Could this work to give a team a black head?
workspace.ChildAdded:connect(function(child)
if child:IsA("Model") and child.Team== "Red Team" then
child:WaitForChild("Body Colors")
child["Body Colors"].HeadColor = BrickColor.new("Really black")
end
end) |
|
|
if game.Players.Player.TeamColor == BrickColor.new("Color here") then
--More Code Here
end |
|
ExlluminaJoin Date: 2014-06-28 Post Count: 6314 |
It seems to be okay. |
|
|
for i, v in pairs(game.Players:GetChildren()) do
if v.Character and v.TeamColor == BrickColor.new("Really red") then
v:FindFirstChild("Head").BrickColor = BrickColor.new("Really black")
end
end) |
|
ZelphurxJoin Date: 2012-12-15 Post Count: 534 |
Anoy, I tried that and this came up:
16:08:48.139 - Player is not a valid member of Players |
|
|
"Player" was just an example, I would suggest using the examples provided by the other users. |
|
ZelphurxJoin Date: 2012-12-15 Post Count: 534 |
Master, this didn't work
for i, v in pairs(game.Players:GetChildren()) do
if v.Character and v.TeamColor == BrickColor.new("White") then
v:FindFirstChild("Head").BrickColor = BrickColor.new("Really black")
end
end |
|
ExlluminaJoin Date: 2014-06-28 Post Count: 6314 |
I don't know to script but I think there should "TeamColor" somewhere. |
|
ZelphurxJoin Date: 2012-12-15 Post Count: 534 |
There is. And nothing has worked so far. |
|
ZelphurxJoin Date: 2012-12-15 Post Count: 534 |
Nothing is really working, can anyone help? |
|
|
v.Character:FindFirstChild("Head").BrickColor = BrickColor.new("Really black")
Try that. |
|
ZelphurxJoin Date: 2012-12-15 Post Count: 534 |
What do i put before and after that? It doesnt say anything about finding the team. |
|
ZelphurxJoin Date: 2012-12-15 Post Count: 534 |
I mean, that cant be the script on it's own. |
|
|
Place it on the third line of the original script provided, additionally,
you may also want to read this article regarding loops,
http://wiki.roblox.com/index.php?title=Generic_for |
|