Here's the code. ** Error on line 15.** I want to put a countdown in the players of the "current" table.
--Made by Aceta players = game.Players:GetPlayers() local piece = Workspace.teleportationpart local map = Workspace.Map current = {} function teleportPlayers() for i, v in pairs(players) do if v.play.Value == true then v.Character.Torso.CFrame = CFrame.new(piece.Position+Vector3.new( math.random(1,10), math.random(2,6), math.random(1,10))) table.insert(v,current) end end end function countdown() for i, v in pairs(current) do local stats = v.PlayerGui.fullGui.everything.gamePlay.informer stats.Text = '3' wait(1) stats.Text = '2' wait(1) stats.Text = '1' wait(1) stats.Text = 'Begin!' stats.FontSize = 'Size48' end end
And...Fixed.
--Made by Aceta players = game.Players:GetPlayers() local piece = Workspace.teleportationpart local map = Workspace.Map current = {} function teleportPlayers() for i, v in pairs(players) do if v.play.Value == true then v.Character.Torso.CFrame = CFrame.new(piece.Position+Vector3.new( math.random(1,10), math.random(2,6), math.random(1,10))) table.insert(current, v.Name) end end end function countdown() for i, v in pairs(current) do local stats = game.Players:FindFirstChild(v).PlayerGui.fullGui.everything.gamePlay.informer stats.Text = '3' wait(1) stats.Text = '2' wait(1) stats.Text = '1' wait(1) stats.Text = 'Begin!' stats.FontSize = 'Size48' end end teleportPlayers() countdown()
When you use table.insert
, the table goes first, then the element. So the correct syntax would be table.insert(current,v) instead of table.insert(v,current)
. Hope this helped