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: How do I add a player to a table,then remove them when they

Previous Thread :: Next Thread 
GIassWindows is not online. GIassWindows
Joined: 03 Oct 2016
Total Posts: 285
30 Apr 2017 11:50 AM
die?




say like a round starts,i want their names to be put into a table then when they die,their names get removed from the table.

I want to put it in my script vvv


while true do
if game.Players.NumPlayers >= 1 then
game.Workspace.Intermission.Playing = true
for i = 10, 1, -1 do
textLabel.Text = "Intermission: "..i
wait(1)
end
textLabel.Text = "Intermission: 0"
wait(1)
textLabel.Text = "I see you're looking at this text ;)"
wait()
textLabel.Text = " "
wait(1)
textLabel.Text = "pls w8 we make map ;,,("
wait(5)
local mapOne = game:GetService("ReplicatedStorage")
mapcloned = mapOne.Map:Clone()
mapcloned.Parent = game.Workspace
textLabel.Text = "Making Map,please wait..."
target = CFrame.new(2, 318.5, -21)
for i, player in ipairs(game.Players:GetChildren()) do
if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
player.Character.HumanoidRootPart.CFrame = target + Vector3.new(0, i * 5, 0)
end
end
wait()
textLabel.Text = ""
else
textLabel.Text = "Not enough players.Need at least 2 people."
end
wait(1)
end

print("successful")






ok
Report Abuse
NilLogic is not online. NilLogic
Joined: 08 Apr 2016
Total Posts: 1369
30 Apr 2017 11:50 AM
I hope that the link(s) below will help answer your question.

wiki.roblox.com/index.php?title=Making_a_New_Game
wiki.roblox.com/index.php?title=Intro_to_Scripting
wiki.roblox.com/index.php?title=Vector3_Math

I am just a friendly bot trying to help you, I will get smarter!
Feel free to suggest links, the current config can be found on pastebin: aiudMAhN
Join the fan group: https://www.roblox.com/My/Groups.aspx?gid=3201548
Report Abuse
Thedagz is not online. Thedagz
Joined: 10 Mar 2012
Total Posts: 798
30 Apr 2017 11:53 AM
local PlayersTable = {}

PlayersTable[#PlayersTable + 1] = Player -- Adding

for i = 1,#PlayersTable do -- removing
local PlayerInTable = PlayersTable[i]
if PlayerInTable == Player then
table.remove(PlayersTable,i)
break
end
end
Report Abuse
GIassWindows is not online. GIassWindows
Joined: 03 Oct 2016
Total Posts: 285
30 Apr 2017 12:02 PM
I seriously don't know how that works xd


ok
Report Abuse
Mouse_Potatoe is online. Mouse_Potatoe
Joined: 14 Jul 2011
Total Posts: 1563
30 Apr 2017 12:04 PM
I think there is a function that is called .Changed I don't remember how it's used. Look on the wiki.
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
30 Apr 2017 12:05 PM
y would u need to use changed
there is a died event and tables dont have 'changed' without metamethods
Report Abuse
GIassWindows is not online. GIassWindows
Joined: 03 Oct 2016
Total Posts: 285
30 Apr 2017 12:10 PM
idk if i should bump or not,wait...


ok
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
30 Apr 2017 12:16 PM
u can try it with the dictionary version too

local list = {}
for _, player in ipairs( alive_players ) do
list[ player ] = true
--get humanoid
humanoid.Died:connect( function()
list[ player ] = nil
CheckWinners()
end )
end


--to see if there is only 1 person left alive:
next( player, next( player ) )
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