generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Glitchy script help

Previous Thread :: Next Thread 
Frostglacier is not online. Frostglacier
Joined: 28 Oct 2010
Total Posts: 4177
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
Frostglacier is not online. Frostglacier
Joined: 28 Oct 2010
Total Posts: 4177
21 May 2013 10:07 PM
Does anyone need me to clarify? :/
Report Abuse
1Topcop is not online. 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 is not online. 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 is not online. 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 is not online. 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
Frostglacier is not online. Frostglacier
Joined: 28 Oct 2010
Total Posts: 4177
21 May 2013 10:57 PM
Curse you, CTRL+V.

Thanks for pointing that out; I'll fix it.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image