I want to show the blackscreen gui for all players in _G.gameplayers at the same time. now it does that the player1 gets the blackscreen and after a amount of time player2 gets it. Not at the same time.... plez help

local replicatedstorage = game:GetService("ReplicatedStorage") 
local status = replicatedstorage:WaitForChild("InfoValue")
local round = replicatedstorage:WaitForChild("RoundValue")
local mapstorage = game.workspace:WaitForChild("mapStorage")
local player = game.Players:GetChildren()
local ServerStorage = game:GetService("ServerStorage")
local cam = game.Workspace.CurrentCamera
local cam1 = game.Workspace.Camera1
local roundframe = game.StarterGui.StatusValue1:FindFirstChild("RoundStatus")
local schluss = replicatedstorage:WaitForChild("SchlussValue")
--Falls jemand geld kriegt
--game.Players.leaderstats.Wins.Value = game.Players.leaderstats.Wins.Value + 1




while true do
	
	
round.Value = ""
roundframe.Visible = false
	
	
for i, v in pairs(game.Players:GetChildren(_G.gameplayers)) do
--Mache das Camera Gui Sichtbar
v.PlayerGui.StatusValue1.RoundStatus.Visible = false
v.PlayerGui.SpectateGui.Button.Visible = true
v.PlayerGui.FakeCamera.stripes.Visible = true
v.PlayerGui.FakeCamera.Linse.Visible = true
v.PlayerGui.FakeCamera.Visier.Visible = true
v.PlayerGui.FakeCamera.buchstaben.Visible = true
v.PlayerGui.FakeCamera.Battery.Visible = true
v.PlayerGui.FakeCamera.Auge.Visible = true
v.PlayerGui.FakeCamera.Recording.Visible = true
v.PlayerGui.StatusValue1.RoundStatus.Visible = false
wait(1)
for i = 0, 1,0.1 do
	v.PlayerGui.BlackScreen.black.Transparency = i
wait()
	end
end

--Die Zeit bevor die Runde fast anfängt
status.Value = "Intermission"
wait(4)

--Spiel startet in 15 Sekunden
for i = 15,0,-1 do
	status.Value = "Game starts in "..i.." seconds"
	wait(1)
end


--Nimmt alle Spieler die zurzeit dort sind und packt die in _G.gameplayers ( alle spieler die spielen )
_G.gameplayers = {}
for i, v in pairs(game.Players:GetPlayers()) do
local player = game.Players:GetChildren()
if v then
table.insert(_G.gameplayers, v.Name)
end
end 

--Spiel startet gleich 
status.Value = "Game is about to start soon!"
wait(1.5)
status.Value = ""

for i, v in pairs(game.Players:GetChildren(_G.gameplayers)) do
	
for fade = 1, 0,-0.1 do
v.PlayerGui.BlackScreen.black.Transparency = fade
	wait()
end
v.PlayerGui.StatusValue1.RoundStatus.Visible = true
v.PlayerGui.FakeCamera.stripes.Visible = false
v.PlayerGui.SpectateGui.Button.Visible = false
v.PlayerGui.SpectateGui.Bar.Visible = false
v.PlayerGui.FakeCamera.Linse.Visible = false
v.PlayerGui.FakeCamera.Visier.Visible = false
v.PlayerGui.FakeCamera.buchstaben.Visible = false
v.PlayerGui.FakeCamera.Battery.Visible = false
v.PlayerGui.FakeCamera.Auge.Visible = false
v.PlayerGui.FakeCamera.Recording.Visible = false

				for fade = 0, 1,0.1 do
v.PlayerGui.BlackScreen.black.Transparency = fade
wait()
	end
end

local mapsinserverstorage = game:GetService("ServerStorage").Maps:GetChildren()
local chosenmap = mapsinserverstorage[math.random(1,#mapsinserverstorage)]
chosenmap:Clone().Parent = mapstorage
local spawns = chosenmap:WaitForChild("Spawns"):GetChildren()
for _,Player in pairs(game.Players:GetPlayers(_G.gameplayers)) do
	if Player and #spawns > 0 then
		local torso = Player.Character:WaitForChild("Torso")
		local allspawns = math.random(1, #spawns)
		local randomspawn = spawns[allspawns]
		if randomspawn and torso then
			table.remove(spawns, allspawns)
			--Teleportiere die Spieler in das Spiel
			
			torso.CFrame = CFrame.new(randomspawn.Position + Vector3.new(0,2,0))

			--Teleportiere den Gegner AI in die Map
			local enemie = game.ReplicatedStorage:FindFirstChild("Enemies"):GetChildren()
			GegnerStorage = game.workspace:WaitForChild("GegnerStorage")
			for _,obj in pairs(enemie) do
   			obj:Clone().Parent = GegnerStorage
			end

	
		
			--Waffen werden hinzugefügt
			
			--local M4AR = game.ReplicatedStorage.M4AR
			--local newM4 = M4AR:Clone()
			--newM4.Parent = Player.Backpack
		end
	end
end

for i = 30,0,-1 do
	wait(1)
	--Wenn die Zeit abgelaufen ist
	if i == 0 then
		schluss.Value = "Your Team lost! Time was up"
		wait(2)
		status.Value = ""
	schluss.Value = ""
round.Value = ""
		break
	end
	--Die Gegner haben gewonnen da keine Spieler mehr am Leben sind
	if #_G.gameplayers == 0 then
				schluss.Value = "Your Team lost!"
				wait(2)
				status.Value = ""
	schluss.Value = ""
round.Value = ""
				break
	end
	if #GegnerStorage:GetChildren() == 0 then
		schluss.Value = "Your Team won!"
		wait(2)
		status.Value = ""
	schluss.Value = ""
round.Value = ""
		break
	else
		round.Value = i.." seconds remaining"
end
end
local spawns = game.Workspace.Lobby:WaitForChild("Spawns"):GetChildren()
for _,Player in pairs(game.Players:GetPlayers(_G.gameplayers)) do
	for i, v in pairs(game.Players:GetChildren()) do
					for i = 1, 0,-0.1 do
v.PlayerGui.BlackScreen.black.Transparency = i
wait()
	end
	wait(2)
end
	if Player and #spawns > 0 then
		local torso = Player.Character:WaitForChild("Torso")
		local allspawns = math.random(1, #spawns)
		local randomspawn = spawns[allspawns]
		if randomspawn and torso then
			table.remove(spawns, allspawns)
			torso.CFrame = CFrame.new(randomspawn.Position + Vector3.new(0,2,0))
			Player.Backpack:ClearAllChildren()
			status.Value = " "
			wait()
		end
	end
end

--Entfernt alle Tools am ende jeder Runde
--leert die Map aus Mapstorage und die Gegnerstorage komplett
mapstorage:ClearAllChildren{}
GegnerStorage:ClearAllChildren{}
wait()
end

2 comments

0

guess no one is gonna help me with such a big script

0

for loop does do each player one at a time though, and maybe use game.players.localplayer instead of _G.gameplayers