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: PlayerLeaving fire for ONLY ONE player..?

Previous Thread :: Next Thread 
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
17 Feb 2017 01:16 AM
Title.
Report Abuse
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
17 Feb 2017 01:22 AM
for i,v in pairs(game.Players:GetChildren()) do if # then if ########### then if ########### and ###################################### and ########################### > 0 then local human = #################### human.Died:connect(function() if # then survivors = survivors - 1 end end) survivors = survivors + 1 end end game.Players.PlayerRemoving:connect(function(plr) print(plr.Name..' left') survivors = survivors - 1 end) end end
Report Abuse
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
17 Feb 2017 01:24 AM
for i,v in pairs(game.Players:GetChildren()) do
if v then
if v.Character then
--if statement FOR THE CHARACTER
local human = v.Character.Humanoid
human.Died:connect(function()
if v then
survivors = survivors - 1
end
end)
survivors = survivors + 1
--end
end

game.Players.PlayerRemoving:connect(function(plr)
print(plr.Name..' left')
survivors = survivors - 1
end)
end
end
Report Abuse
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
17 Feb 2017 02:22 AM
:c
Report Abuse
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
17 Feb 2017 02:36 AM
b
Report Abuse
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
17 Feb 2017 02:12 PM
b
Report Abuse
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
17 Feb 2017 02:15 PM
I can't just use an if statement I just need it to be attached to the one player as with this method it fires like 50 times and I just need it to fire once for that specific player.
Report Abuse
mister1nothing is not online. mister1nothing
Joined: 27 Dec 2007
Total Posts: 579
17 Feb 2017 02:19 PM
Part of the reason nobody's helping is the script snippet you posted as the first reply got hit rather hard by tags. Try reposting it, or failing that, provide us with a PasteBin ID.


Report Abuse
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
17 Feb 2017 02:20 PM
Or you can scroll down a bit, to see the script.
Report Abuse
foreverpower is not online. foreverpower
Joined: 05 Feb 2011
Total Posts: 5578
17 Feb 2017 02:22 PM
Because it's within a loop.


Report Abuse
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
17 Feb 2017 02:24 PM
^ Yep, sorta needs to be.
Report Abuse
mister1nothing is not online. mister1nothing
Joined: 27 Dec 2007
Total Posts: 579
17 Feb 2017 02:25 PM
That works too.

What happens if you print(v) at various loop levels? Like before Humanoid.Died, for example, and before all "if(v) then"?


Report Abuse
mister1nothing is not online. mister1nothing
Joined: 27 Dec 2007
Total Posts: 579
17 Feb 2017 02:27 PM
(note doing what I suggest may result in errors, you'll want to use print("Value: " ..v.. "") in order to convert the value to a String.)


Report Abuse
Zarkonan_Zenheart is not online. Zarkonan_Zenheart
Joined: 29 May 2012
Total Posts: 610
17 Feb 2017 02:28 PM
why on earth can't you just use an if statement?
Report Abuse
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
17 Feb 2017 02:58 PM
b
Report Abuse
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
17 Feb 2017 02:59 PM
Also .Died works perfectly fine, I just need this.
Report Abuse
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
17 Feb 2017 03:04 PM
b
Report Abuse
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
17 Feb 2017 03:30 PM
b
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
17 Feb 2017 03:43 PM
you dont put the connection inside the for loop.


Report Abuse
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
17 Feb 2017 03:48 PM
for i,v in pairs(game.Players:GetChildren()) do
if v then
if v.Character then
--if statement FOR THE CHARACTER
local human = v.Character.Humanoid
human.Died:connect(function()
if v then
survivors = survivors - 1
end
end)
survivors = survivors + 1
--end
end

game.Players.PlayerRemoving:connect(function(plr)
print(plr.Name..' left')
survivors = survivors - 1
end)
end
end
Report Abuse
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
17 Feb 2017 03:58 PM
:c
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
17 Feb 2017 04:04 PM
did u not read that i said


Report Abuse
Zarkonan_Zenheart is not online. Zarkonan_Zenheart
Joined: 29 May 2012
Total Posts: 610
17 Feb 2017 04:04 PM
for i,v in pairs(game.Players:GetChildren()) do
if v then
if v.Character then
--if statement FOR THE CHARACTER
local human = v.Character.Humanoid
human.Died:connect(function()
if v then
survivors = survivors - 1
end
end)
survivors = survivors + 1
--end
end
end
end

game.Players.PlayerRemoving:connect(function(plr)
print(plr.Name..' left')
survivors = survivors - 1
end)

only fires for one person...
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
17 Feb 2017 04:06 PM
for i,v in next, game.Players:GetPlayers() do survivors = survivors + 1 local human = #################################### human.Died:connect(function() survivors = survivors - 1 end) end game.Players.PlayerRemoving:connect(function(player) print(player,' left') survivors = survivors - 1 end)
Report Abuse
BinaryResolved is not online. BinaryResolved
Joined: 04 Nov 2013
Total Posts: 355
17 Feb 2017 04:06 PM
for i,v in pairs(game.Players:GetChildren()) do
if v then
if v.Character then
--if statement FOR THE CHARACTER
local human = v.Character.Humanoid
human.Died:connect(function()
if v then
survivors = survivors - 1
end
end)
survivors = survivors + 1
--end
end

end
end

game.Players.PlayerRemoving:connect(function(plr)
print(plr.Name..' left')
survivors = survivors - 1
end)

Try that, it will only fire for the players that where in the game when the loop started.
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