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: Quick question

Previous Thread :: Next Thread 
WishNite is not online. WishNite
Joined: 11 Feb 2009
Total Posts: 15828
30 Jul 2011 05:53 PM
Okay let's say I have something like this:

for i, v(game:Players:GetPlayers()) do
if v.Name == Player then
v.Character:remove()
end
end

Does that remove EVERYONE, or does that remove only the Player named Player?
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
30 Jul 2011 05:57 PM
It removes no one because it would error on the first line :3
Report Abuse
WishNite is not online. WishNite
Joined: 11 Feb 2009
Total Posts: 15828
30 Jul 2011 05:58 PM
Oops. Made a tiny little mistake.


for i, v in pairs(game:Players:GetPlayers()) do
if v.Name == Player then
v.Character:remove()
end
end

There.

Will this remove everyone's character, or just the one named "Player"
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
30 Jul 2011 05:58 PM
It removes no one, because it will still error on the first line :3
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
30 Jul 2011 05:59 PM
Well, if you used the pairs function it'd remove only Player, but since you didn't... Oh, and yes, the ifrst line errors.

for i, v in pairs(game:Players:GetPlayers()) do
if v.Name == Player then
v.Character:remove()
end
end

Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
30 Jul 2011 05:59 PM
@electric

Still errors on the first line :3
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
30 Jul 2011 05:59 PM
Wait, another error. O_O

"game:Players"? Lol.

for i, v in pairs(game.Players:GetPlayers()) do
if v.Name == Player then
v.Character:remove()
end
end

Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
30 Jul 2011 06:00 PM
Yeah, I didn't even see the colon there. xP
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
30 Jul 2011 06:00 PM
Agh, I keep spotting errors.

for i, v in pairs(game.Players:GetPlayers()) do
if v.Name == Z"Player" then
v.Character:remove()
end
end

--floodcheck--

Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
30 Jul 2011 06:01 PM
@electric

Better. That will only delete the person named Player, if you ever choose to define that variable :3
Report Abuse
WishNite is not online. WishNite
Joined: 11 Feb 2009
Total Posts: 15828
30 Jul 2011 06:01 PM
You guys still understand my question, right?

It removes only the Player's character, okay.
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
30 Jul 2011 06:01 PM
Ignore the Z there, that was a typo. ._.
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