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

This script works in studio but not play? What's wrong with my script anyway?

Asked by 9 years ago
01game.Players.PlayerAdded:connect(function(player)
02        while not player.Character do wait() end
03    local Ch=player.Character
04        Ch["Torso"].BrickColor=BrickColor.Black()
05    Ch["Head"].BrickColor=BrickColor.Red()
06    Ch["Head"].face.Texture = 'http://www.roblox.com/asset/?id=135269441'
07    Ch["Left Arm"].BrickColor=BrickColor.Black()
08    Ch["Right Arm"].BrickColor=BrickColor.Black()
09    Ch["Left Leg"].BrickColor=BrickColor.Black()
10    Ch["Right Leg"].BrickColor=BrickColor.Black()
11end)
12 
13 
14-- WHAT'S WRONG WITH IT?!

1 answer

Log in to vote
1
Answered by
Mokiros 135
9 years ago

After PlayerAdded event, you can use CharacterAdded event to find loaded character.

01game.Players.PlayerAdded:connect(function(plr)
02    plr.CharacterAdded:connect(function(character)
03        character:WaitForChild("Torso").BrickColor=BrickColor.Black()
04        character:WaitForChild("Head").BrickColor=BrickColor.Red()
05        character:WaitForChild("Head").face.Texture = 'http://www.roblox.com/asset/?id=135269441'
06        character:WaitForChild("Left Arm").BrickColor=BrickColor.Black()
07        character:WaitForChild("Right Arm").BrickColor=BrickColor.Black()
08        character:WaitForChild("Left Leg").BrickColor=BrickColor.Black()
09        character:WaitForChild("Right Leg").BrickColor=BrickColor.Black()
10        --[[    I used :WaitForChild() to give character time to load]]
11    end)
12end)

Also, you can change BodyColors:

01game.Players.PlayerAdded:connect(function(plr)
02    plr.CharacterAdded:connect(function(character)
03        character:WaitForChild("Body Colors")
04        character["Body Colors"].TorsoColor = BrickColor.Black()
05        character["Body Colors"].HeadColor = BrickColor.Black()
06        character:WaitForChild("Head")
07        character.Head:WaitForChild("face").Texture = 'http://www.roblox.com/asset/?id=135269441'
08        character["Body Colors"].LeftArmColor = BrickColor.Black()
09        character["Body Colors"].RightArmColor = BrickColor.Black()
10        character["Body Colors"].LeftLegColor = BrickColor.Black()
11        character["Body Colors"].RightLegColor = BrickColor.Black()
12end)
13end)

P.S. You can press F9 in online mode to go to developer console, and search for script errors.

0
Thanks because I'm scirping a werewolf and it's aggravating. And tbh this is still not working! When I go to Test Server Mode in studio? It works, when I go to Play mode from the website? IT DOESNT WORK!! james24dj 90 — 9y
Ad

Answer this question