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 » Scripters
Home Search
 

Re: Why doesn't this work

Previous Thread :: Next Thread 
CosmicPigeon is not online. CosmicPigeon
Joined: 14 Oct 2012
Total Posts: 5978
23 May 2017 10:51 PM
It is suppose to remove the player's accessories when joined
it DOES print the char.Name



function onPlayerEntered(newPlayer)
game.Workspace:WaitForChild(newPlayer.Name)
local char = game.Workspace:FindFirstChild(newPlayer.Name)
if char then
print(char.Name)
wait(0.1)
local w = char:GetChildren()
for i = 1, #w do
local c = w[i]:GetChildren()
for i=1, #c do
if (c[i].className == "Accessory") then
c[i]:remove()
end
end
end
end
end

game.Players.PlayerAdded:connect(onPlayerEntered)


Report Abuse
LinkMe is not online. LinkMe
Joined: 30 Apr 2009
Total Posts: 512
23 May 2017 10:56 PM
Try using the RemoveAccessories function.
Report Abuse
CosmicPigeon is not online. CosmicPigeon
Joined: 14 Oct 2012
Total Posts: 5978
23 May 2017 10:57 PM
@LinkMe
Example?


Report Abuse
LinkMe is not online. LinkMe
Joined: 30 Apr 2009
Total Posts: 512
23 May 2017 10:58 PM
wiki.roblox.com/index.php?title=API:Class/Humanoid/RemoveAccessories
Report Abuse
CosmicPigeon is not online. CosmicPigeon
Joined: 14 Oct 2012
Total Posts: 5978
23 May 2017 11:10 PM
@LinkMe

So I would do

character.Humanoid:RemoveAccessories()


Report Abuse
Jake_Kinq is not online. Jake_Kinq
Joined: 23 May 2015
Total Posts: 72
23 May 2017 11:11 PM
it looks valid,but do what that other guy said.
Report Abuse
CosmicPigeon is not online. CosmicPigeon
Joined: 14 Oct 2012
Total Posts: 5978
23 May 2017 11:15 PM
@Jake_Kinq
Its not working


Report Abuse
wjg999 is not online. wjg999
Joined: 04 Nov 2011
Total Posts: 95
24 May 2017 02:13 AM
might want to change the second i to a j or something else since it is adding to i in both loops , meaning that if it ends the inner loop it would suddenly be in the outer loop with an i of of a number other than 1 thus it skips a lot.
Report Abuse
wjg999 is not online. wjg999
Joined: 04 Nov 2011
Total Posts: 95
24 May 2017 02:21 AM
2nd thing, :remove() shifts the table so in the second loop will skip over parts if it does not subtract 1 from the second i inside the if statement since if c[1] was removed c[2] is now in c[1] its spot
Report Abuse
wjg999 is not online. wjg999
Joined: 04 Nov 2011
Total Posts: 95
24 May 2017 02:41 AM
scrap that last bit, thought it was removing stuff from the table, not just the item
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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