Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Script not accessing the player guis?

Asked by 8 years ago

Hi I really need help. Lemme explain, when all the players die a imagelabel shows up. Thats not working. Like not being visible. Can you help?

local alive = #game.Players:GetPlayers()
local number = 0
local parent = game.Workspace.ZombiesAlive
local timer = Instance.new("Hint",game.Workspace)

game.Players.PlayerAdded:connect(function(player)
    alive = alive + 1
    print(alive)
    player.CharacterAdded:connect(function(character)
        character:WaitForChild("Humanoid").Died:connect(function()
        alive = alive - 1
        print(alive)
        if alive == 0 then
            print("No survivors")
            for i,v in pairs (game.Players:GetPlayers()) do
                v.Character:MovTeTo(Vector3.new(-6, 0.5, -11))

                local playerGui = v.PlayerGui
                playerGui.ScreenGui.TextLabel.Visible = true
            end
        end
    end)
end)

player.Chatted:connect(function(msg)

end)

parent.ChildAdded:connect(function( child )
  if child:IsA("Model") then
    number = number + 1
    warn(child:GetFullName(), number)
  end
end)

parent.ChildRemoved:connect(function( child )
  if child:IsA("Model") then
    number = number - 1
    warn(number)
  end
end)
end

while true do
    wait()
    for timer1 = 10, 1, -1 do
        timer.Text = "There is "..timer1.." seconds left."
        wait(1)
    end
    repeat
        wait(.5)
    until alive == 0

    -- Add code here for more things, basically the code here will run after everyone's dead.
    -- You also have it setup that a new game will run right after another, so keep that in mind!
end)

Answer this question