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: Need help on tournament script

Previous Thread :: Next Thread 
DarkSuperSonic64 is not online. DarkSuperSonic64
Joined: 02 Sep 2014
Total Posts: 9
28 Sep 2014 01:24 AM
Hey guys, so i am creating a tournament and i am having trouble scripting.Can someone please tell me how to check which players are alive during the round and which players have died
Report Abuse
HarrySnotte is not online. HarrySnotte
Joined: 27 Jun 2011
Total Posts: 2854
28 Sep 2014 04:20 AM
I would do it like this:

for i,v in ipairs(game.Players:GetChildren()) do
local b = Instance.new("BoolValue", script)
b.Name = v.Name
b.Value = true
v.Character.Humanoid.Died:connect(function()
if script:findFirstChild(v.Name) then
script:findFirstChild(v.Name).Value = false
end
end)
end

--This makes a BoolValue for every player. If it's set to true, it means the player is alive, if it's false, the player died. If a new round starts, you should make it remove all the values again and insert new ones.
Report Abuse
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
28 Sep 2014 04:50 AM

Just make a player data object...

local PlayerData = {}
PlayerData.new = function(name)
local this = {}
this.Name = name
this.Dead = false
this.Points = 0
return this
end

local Players = {}

local removePlayer = function(plr)
table.insert(Players, PlayerData.new(plr.Name)
end

local addPlayer = function(plr)
for _, v in pairs(Players:GetChildren()) do
if(v.Name == plr.Name)then
table.remove(Players, v)
end
end
end

game.Players.PlayerRemoving:connect(function(player)
removePlayer(player)
end)

game.Players.PlayerAdded:connect(function(player)
addPlayer(player)
end)
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