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: This doesn't seem to work even in multiplayer mode.

Previous Thread :: Next Thread 
0rka is not online. 0rka
Joined: 26 Dec 2013
Total Posts: 1070
22 Feb 2014 12:27 PM
function iterate(item)
for i,v in pairs(item:GetChildren()) do
if v:IsA("ShirtGraphic") or (v.Name == "roblox" and v:IsA("Decal")) then
v:Remove()
else
local grandChildren = v:GetChildren()
if #grandChildren > 0 then
iterate(v)
end
end
end
end

game.Players.PlayerAdded:connect(function(plr)

for i,v in pairs(plr.Character:GetChildren()) do
if v:IsA("Hat") then
v:Remove()
elseif v:IsA("Shirt") then
v.ShirtTemplate = "http://www.roblox.com/asset/?id=142329377"
elseif v:IsA("Pants") then
v.PantsTemplate = "http://www.roblox.com/asset/?id=142329390"
end
end

iterate(plr)
plr.Character:FindFirstChild("Shirt Graphic", true):Remove()

end)

-- this gives me no errors in build mode.
Report Abuse
yankeejr is not online. yankeejr
Joined: 04 Jul 2012
Total Posts: 4906
22 Feb 2014 12:36 PM
I don't see an issue.
Report Abuse
NotRobotmega is not online. NotRobotmega
Joined: 01 Jul 2013
Total Posts: 605
22 Feb 2014 01:02 PM
ur trying to get character rite after player appears tats y
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
22 Feb 2014 01:12 PM
--you're trying to access the character before it loads, two solutions:

game.Players.PlayerAdded:connect(function(plr)
plr:WaitForDataReady()
CODING HERE
end)



OR




game.Players.PlayerAdded:connect(function(plr)
repeat wait() until plr.Character
CODING HERE
end)
Report Abuse
VerifiedName is not online. VerifiedName
Joined: 26 Jul 2009
Total Posts: 4534
22 Feb 2014 01:46 PM
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(char)
--code
end)
end)

#nerdsunited
Report Abuse
0rka is not online. 0rka
Joined: 26 Dec 2013
Total Posts: 1070
23 Feb 2014 07:40 PM
I tried it with plr:WaitForDataReady() before and it didn't seem to work either.
Report Abuse
fireheart568 is not online. fireheart568
Joined: 04 Jan 2009
Total Posts: 1285
23 Feb 2014 07:41 PM
You could also try plr.CharacterAdded:wait() if you wanted...
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