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: Simple coding problem

Previous Thread :: Next Thread 
JamSnack is not online. JamSnack
Joined: 04 Aug 2011
Total Posts: 154
06 Aug 2017 08:39 PM
This chunk of code does not have an error, I just needed to know how I would add a check to it so it checks if there are no more players left alive. #_G.gameplayers contains how many players are still alive, if 1 is still alive they are rewarded Zelch. If two players are fighting and they both kill each other the timer ticks down until the match is over.

if #_G.gameplayers == 1 then
for i, v in pairs(_G.gameplayers) do
if v ~= nil then
status.Value = v.." remains"
game.Players[v].leaderstats.Zelch.Value = game.Players[v].leaderstats.Zelch.Value + 10
break
end
end
break
else
status.Value = i.." seconds remain"
end
end





I expect the code to be something like if v == nil then
status.Value = "Noone remains."
Report Abuse
Vultorz is not online. Vultorz
Joined: 02 Mar 2015
Total Posts: 2985
06 Aug 2017 08:41 PM
if #game.Players:GetPlayers() == 0
Report Abuse
Sur4y is online. Sur4y
Joined: 05 Jul 2013
Total Posts: 5669
06 Aug 2017 08:43 PM
elseif #_G.gameplayers == 0 then


ᕕ( ᐛ )ᕗ / @Sur0100y / Every good thing has an ending. [RT]
Report Abuse
Vultorz is not online. Vultorz
Joined: 02 Mar 2015
Total Posts: 2985
06 Aug 2017 08:43 PM
ew _G is gr0ss
Report Abuse
JamSnack is not online. JamSnack
Joined: 04 Aug 2011
Total Posts: 154
06 Aug 2017 08:45 PM
Time to spend the next hour trying to kill myself and a clone of the roblox simulation before it calculates that 1 player is still alive. - ;P;
Report Abuse
PapaSherms is not online. PapaSherms
Joined: 13 Jul 2015
Total Posts: 48
06 Aug 2017 08:48 PM
Your going off AlvinBlox's games videos. And how I know is the code(Photographic Memory)! _G is mostly used globally. How he approached it made more sense than you do. I would help you but i don't really know what you are trying to achieve. Sorry!
Report Abuse
JamSnack is not online. JamSnack
Joined: 04 Aug 2011
Total Posts: 154
06 Aug 2017 08:51 PM
Yeah I am new to LUA so I am reverse engineering things and have surprisingly made a ton of stuff on my own from that one tutorial. Basically if there are two players when a round is still going on and they kill each other in the same second, the code checks if 1 of them are still alive. If none are alive it then the number is 0 and it counts down checking to see if 1 person is alive.
Report Abuse
JamSnack is not online. JamSnack
Joined: 04 Aug 2011
Total Posts: 154
06 Aug 2017 08:57 PM
I found a solution.
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