local room1 = false
local room2 = false
local room3 = false
local room4 = false
local room5 = false
local room6 = false


rooms = {}





game.Players.PlayerAdded:connect(function(plr)
	if room1 == false then
		room1 = true
		
	
	local spawn1 = game.Workspace.room1
	spawn1.Name = plr.UserId
	table.insert(rooms,spawn1)
	

	
	
	
	elseif room2 == false then 
		
		
		local spawn2 = game.Workspace.room2
		spawn2.Nmae = plr.UserId
		table.insert(rooms,spawn2)
	end
	
	
	plr.Character.Humanoid.Died:connect(function()
	
	wait(2) plr.Character.HumanoidRootPart.Position = rooms[plr.Name]
	
	
	
end)
	
	
	
end)

I'm basically trying to make each player have their own spawn point as they join a game and remove them from that table when they leave, but I'm new to tables and I'm having a very bad time understanding I tried you tube and wiki but it doesn't make sense to me. I would really appreciate an explanation to help me understand so i can further apply it to other things, Thanks.

2 comments

0

Tables are places where you store multiple stuff, its like an array.

0

So is a table not a good method to do this?