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

Text changing help?

Asked by 8 years ago

I made a previous post about my round system, and someone helped me with it and they changed something about my Text Changer. The problem is whenever I try to start up a server in studio the text says "Label" and it never changes. Could anyone resolve this problem, thanks!

Also, if you see any bugs or errors in my round system, please feel free to point it out with how to change it, thanks!

Text Changer:

function playerNotification(changeText)
    for _,v in pairs (game.Players:GetChildren()) do
        local ScreenGUI = v.PlayerGui:FindFirstChild("ScreenGui")
        if ScreenGUI then
            ScreenGUI.Frame.TextLabel.Text = changeText
        end
    end
end

Rest of the Round System:

function playerNotification(changeText)
    for _,v in pairs (game.Players:GetChildren()) do
        local ScreenGUI = v.PlayerGui:FindFirstChild("ScreenGui")
        if ScreenGUI then
            ScreenGUI.Frame.TextLabel.Text = changeText
        end
    end
end

function waitForPlayers()
    while game.Players.NumPlayers < 2 do
        playerNotification("You need 1 more player to start the round!")
        wait(0)
    end
end

function intermissionTimer()
    if game.Players.NumPlayers >= 2 then
        for countDown = 10, 0, -1 do
            playerNotification("Intermission: " ..countDown)
            wait(0)
        end
    end
end

function displayGamemode()

end

function mapSelection()
    local mapList = game.ReplicatedStorage.Maps:GetChildren()
    local randomMap = math.random(1, #mapList)
    playerNotification("Choosing the map!")
    wait(4)
    local mapChosen = mapList[randomMap]
    playerNotification("The map is: " ..mapChosen.Name)
    local mapClone = mapChosen:Clone()
    mapClone.Parent = game.Workspace
end

function teleportAllPlayers()
    local mapSpawn = CFrame.new(workspace.TeleportTarget.Position)
    for i, player in ipairs(game.Players:GetChildren()) do
        player.Character.Torso.CFrame = mapSpawn + Vector3.new(0, i * 5, 0)
        player.Playing.Value = 1
    end
end

function startTimer()
    for countDown = 3, 0, -1 do
        playerNotification("Game begins in: " ..countDown)
        wait(0)
    end
end

function roundTimer()
    for countDown = 20, 0, -1 do
        playerNotification("Time left: " ..countDown)
        wait(0)
    end
end

function roundEnded()
    playerNotification("The round has ended!")
end

function teleportAlivePlayers()
    local mapSpawn = CFrame.new(workspace.SpawnLocation.Position)
    for i, player in ipairs(game.Players:GetChildren()) do
        player.Character.Torso.CFrame = mapSpawn + Vector3.new(0, i * 5, 0)
        player.Playing.Value = 1
    end
end

function mapDestroy()

end

function showResults()

end

game:GetService('Players').PlayerAdded:connect(function(Player)
    Player.CharacterAdded:connect(function(Character)
        Character:FindFirstChild("Humanoid").Died:connect(function()
            Player.Playing.Value = 0
        end)
    end)

    local Playing = Instance.new("IntValue", Player)
    Playing.Value = 0
    Playing.Name = "Playing"
end)

while true do
    waitForPlayers()
    wait(1)
    intermissionTimer()
    wait(1)
    displayGamemode()
    wait(5)
    mapSelection()
    wait(5)
    teleportAllPlayers()
    wait(1)
    startTimer()
    wait(1)
    roundTimer()
    wait(1)
    roundEnded()
    wait(1)
    teleportAlivePlayers()
    wait(1)
    mapDestroy()
    wait(1)
    showResults()
end
0
If filtering is enabled, the server can't access elements of Player.PlayerGui. 1waffle1 2908 — 8y
0
Is there a way for me to re-script it to make it work with FilteringEnabled? Vestralix 15 — 8y

Answer this question