|
| 21 May 2013 09:25 PM |
This script is supposed to remove all your hats, shirts, etc. and turn your body color to "Institutional white". While testing this, I found that it only worked a few times, and that it usually glitched out leaving the body colors as normal. Is there any way to ensure that my script executes correctly?
game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) wait (1) character.Humanoid.WalkSpeed = 20 bc = character:FindFirstChild("Body Colors") if bc ~= nil then bc.HeadColor = BrickColor.new("Institutional white") bc.TorsoColor = BrickColor.new("Institutional white") bc.RightArmColor = BrickColor.new("Institutional white") bc.LeftArmColor = BrickColor.new("Institutional white") bc.LeftLegColor = BrickColor.new("Institutional white") bc.RightLegColor = BrickColor.new("Institutional white") end p = character:GetChildren() for i = 1, #p do if p[i].ClassName == "Hat" or p[i].ClassName == "Shirt" or p[i].ClassName == "Pants" then p[i]:remove() end end local face = character.Head:FindFirstChild("face") if face then face:remove() end local tee = character.Head:FindFirstChild("roblox") if tee ~= nil then tee:remove() end end) end) |
|
|
| Report Abuse |
|
|
|
| 21 May 2013 10:07 PM |
| Does anyone need me to clarify? :/ |
|
|
| Report Abuse |
|
|
1Topcop
|
  |
| Joined: 09 Jun 2009 |
| Total Posts: 6635 |
|
|
| 21 May 2013 10:21 PM |
Turn this function into a local function, then attach it to the event. Next after you connect it, check if the character already exists, if it does, call the function using the character as an argument. Finally, set the body parts' colors manually because you can't rely on ROBLOX for this.
Example:
function youNewPlayerFunction(Player) local function characterAdded(character) -- your function stuff character.Head.BrickColor = BodyColors.HeadColor -- repeat the line above as needed end Player.Character:connect(characterAdded) if(Player.Character)then characterAdded(Player.Character)end end |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 21 May 2013 10:37 PM |
I would change: if bc ~= nil then to repeat wait() until character:FindFirstChild("Body Colors")
~ The ATR Fishie ~ |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 21 May 2013 10:38 PM |
And what 1Top said. Remove body colors altogether and change each brick instead.
~ The ATR Fishie ~ |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 21 May 2013 10:45 PM |
local tee = character.Head:FindFirstChild("roblox") Seems legit
I keep my T shirts on my head too.
~ The ATR Fishie ~ |
|
|
| Report Abuse |
|
|
|
| 21 May 2013 10:57 PM |
Curse you, CTRL+V.
Thanks for pointing that out; I'll fix it. |
|
|
| Report Abuse |
|
|