LeikaZJoin Date: 2008-01-31 Post Count: 595 |
Why doesn't it work? Output doesn't show any errors.
local Players = game:GetService("Players")
function onPlayerAdded(player)
repeat wait() until player.Character
player.Character.Head.BrickColor = BrickColor.new("Pastel brown")
player.Character.Torso.BrickColor = BrickColor.new("Pastel brown")
player.Character:FindFirstChild("Right Arm").BrickColor = BrickColor.new("Pastel brown")
player.Character:FindFirstChild("Left Arm").BrickColor = BrickColor.new("Pastel brown")
player.Character:FindFirstChild("Left Leg").BrickColor = BrickColor.new("Pastel brown")
player.Character:FindFirstChild("Right Leg").BrickColor = BrickColor.new("Pastel brown")
Players.PlayerAdded:connect(onPlayerAdded)
|
|
LeikaZJoin Date: 2008-01-31 Post Count: 595 |
Is there any other way to change body colors?
|
|
|
game.Players.PlayerAdded:connect(function(plyr)
plyr.CharactedAdded:connect(function()
for _, v in pairs(plyr.Character:GetChildren()) do
if v:IsA('Part') then
v.BrickColor = BrickColor.new('Pastel Brown')
end
end
end)
end)
|
|
LeikaZJoin Date: 2008-01-31 Post Count: 595 |
@cheesecake CharactedAdded is not a valid member of Player
|
|
|
What the heck is CharactedAdded?
I'd go with
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(char)
coroutine.resume(coroutine.create(function()
wait(0.5)
for i,v in pairs(char:GetChildren()) do
if v:IsA("BasePart") then
v.BrickColor = BrickColor.new("Pastel brown")
end
end
end))
end)
end)
-____________________________- |
|
LeikaZJoin Date: 2008-01-31 Post Count: 595 |
lol didin't notice
|
|
LeikaZJoin Date: 2008-01-31 Post Count: 595 |
I don't know why, but my body colors doesn't change when I use both scripts
|
|
|
Also, cheesecake, you should read up on what functions return. You use
plyr.Character
in your for loop, while you could just do
plyr.CharacterAdded:connect(function(char)
for i,v in pairs(char:GetChildren())
-____________________________- |
|
LeikaZJoin Date: 2008-01-31 Post Count: 595 |
Forgot to mention: no errors. :/
|
|
|
Are you using a serverside script?
Is FilteringEnabled on?
If your on a localscript are you running in a client?
-____________________________- |
|
LeikaZJoin Date: 2008-01-31 Post Count: 595 |
Script - Not local (serverside) I guess
FE - Off
I use studio's "Play" mode
|
|
|
Does it work in game?
-____________________________- |
|
LeikaZJoin Date: 2008-01-31 Post Count: 595 |
so apparently it doesn't work in "Play Solo"
Thanks.
|
|
|
Fixed it. The Body Colors Instance was overwriting changes made the characters body color, as the changes were made before it was added to the character. This should work now.
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(char)
local bodyColors = char:WaitForChild("Body Colors")
bodyColors.Parent = nil
for i,v in pairs(char:GetChildren()) do
if v:IsA("BasePart") and v.Name ~= "HumanoidRootPart" then
v.BrickColor = BrickColor.new("Pastel brown")
print(v.Name)
end
end
end)
end)
That should work now.
-____________________________-
-____________________________- |
|