Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local Zone = require(game.ReplicatedStorage.Zone)
- local Container = game.Workspace.IntermissionHitboxZone
- local Zone = Zone.new(Container)
- local PlayerDiplayFrame = game.Workspace.DescriptionPart.SurfaceGui.Frame.PlayersDisplayFrame
- local debounce = true
- local RemainingTime = 10
- local whilelooprunvalue = true
- local debounce2 = true
- local playersinzone = {}
- --idk whu this is here but yeah
- wait(6)
- Zone.playerEntered:Connect(function(player)
- if player then
- local userId = player.UserId
- local thumbType = Enum.ThumbnailType.HeadShot
- local thumbSize = Enum.ThumbnailSize.Size420x420
- local content, isReady = Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)
- if not PlayerDiplayFrame:FindFirstChild(player.Name) then
- local PlayerImage = script.ImageLabel:Clone()
- PlayerImage.Parent = PlayerDiplayFrame
- PlayerImage.Image = content
- PlayerImage.Name = player.Name
- -- adding players to the table
- table.insert(playersinzone,player.Name)
- else
- end
- wait(.6)
- for i,v in pairs(PlayerDiplayFrame:GetChildren()) do
- if v:IsA("ImageLabel") and v.Name == player.Name then
- print(v.Name .. " entered")
- -- print(game.Players:GetPlayers())
- -- local Players = game.Players:GetPlayers()
- -- script.Script.Disabled = false
- for i, theplayer in pairs(Players:GetPlayers()) do
- print(theplayer.Name)
- for i,v in pairs(PlayerDiplayFrame:GetChildren()) do
- if v:IsA("ImageLabel") and v.Name == theplayer.Name then
- print(theplayer.Name)
- -- script.Script.Disabled = false
- if debounce == true then
- debounce = false
- wait(.1)
- end
- if whilelooprunvalue then
- wait(.5)
- whilelooprunvalue = false
- -- local co = coroutine.create((function()
- while not debounce do
- wait()
- -- print("hi")
- if not debounce and not whilelooprunvalue then
- if RemainingTime < 1 and not debounce then
- wait(.1)
- PlayerDiplayFrame.Parent.QueueDescription.Text = "Teleporting All Players into the game"
- PlayerDiplayFrame.Parent.QueueDescription.TextColor3 = Color3.fromRGB(0, 255, 0)
- print("teleporting players")
- wait(1)
- PlayerDiplayFrame.Parent.QueueDescription.Text = "Game will start after 50 seconds or 0/24 players are in!"
- PlayerDiplayFrame.Parent.QueueDescription.TextColor3 = Color3.fromRGB(255, 255, 255)
- RemainingTime = 50
- -- destroying all players is label
- for i,v in pairs(PlayerDiplayFrame:GetChildren()) do
- if v:IsA("ImageLabel") then
- v:Destroy()
- end
- end
- wait(.1)
- -- adding all players in zone that stay after teleporting as labels
- for i,playersimage in pairs(playersinzone) do
- if not PlayerDiplayFrame:FindFirstChild(playersinzone) then
- local PlayerImage = script.ImageLabel:Clone()
- PlayerImage.Parent = PlayerDiplayFrame
- PlayerImage.Image = content
- PlayerImage.Name = playersimage
- print(PlayerImage.Name)
- else
- end
- end
- --whilelooprunvalue = true
- else
- if not whilelooprunvalue then -- not debounce and
- RemainingTime = RemainingTime - 1
- PlayerDiplayFrame.Parent.QueueDescription.Text = "Game will start after " .. RemainingTime .. " seconds or 0/24 players are in!"
- print("Game will start after " .. RemainingTime .. " seconds or 0/24 players are in!")
- if RemainingTime == 3 then
- PlayerDiplayFrame.Parent.QueueDescription.Text = [[Game will start after <font color="rgb(0, 255, 0)">3</font> seconds or 0/24 players are in!]]
- elseif RemainingTime == 2 then
- PlayerDiplayFrame.Parent.QueueDescription.Text = [[Game will start after <font color="rgb(255, 255, 0)">2</font> seconds or 0/24 players are in!]]
- elseif RemainingTime == 1 then
- PlayerDiplayFrame.Parent.QueueDescription.Text = [[Game will start after <font color="rgb(255, 0, 0)">1 </font> seconds or 0/24 players are in!]]
- end
- wait(1)
- else
- PlayerDiplayFrame.Parent.QueueDescription.Text = "Game will start after " .. RemainingTime .. " seconds or 0/24 players are in!"
- RemainingTime = 50
- print("Debounce is true")
- --whilelooprunvalue = true
- return
- end
- end
- end
- end
- -- end))
- -- coroutine.resume(co)
- end
- end
- -- break
- end
- end
- end
- end
- end
- end)
- Zone.playerExited:Connect(function(player)
- if player then
- -- destroying current player is label
- for i,v in pairs(PlayerDiplayFrame:GetChildren()) do
- if v:IsA("ImageLabel") and v.Name == player.Name then
- v:Destroy()
- end
- end
- for i, playersiserver in pairs(Players:GetPlayers()) do
- for i,playerlabels in pairs(PlayerDiplayFrame:GetChildren()) do
- if playerlabels:IsA("ImageLabel") and playerlabels.Name == playersiserver.Name or playerlabels.Name == player.Name then
- warn("theres players in queue")
- break
- elseif not PlayerDiplayFrame:FindFirstChildOfClass("ImageLabel") then
- warn("theres no players in queue")
- print("Resetting Timer Because cant find Players")
- -- script.Script.Disabled = true
- task.wait(.5)
- debounce = true
- PlayerDiplayFrame.Parent.QueueDescription.Text = "Game will start after 50 seconds or 0/24 players are in!"
- RemainingTime = 50
- wait(.1)
- whilelooprunvalue = true
- break
- end
- end
- end
- -- removing the players from the table
- for i,removeplayers in pairs(playersinzone) do
- print(i,removeplayers)
- if removeplayers == player.Name then
- table.remove(playersinzone,i)
- print(removeplayers)
- print(playersinzone)
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement