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

What did I do wrong here?

Asked by 8 years ago
local msg = script.Parent.Parent.StarterGui.Ticker.Ticker.TextLabel

while true do
wait(6)
msg.Text = "Disaster: Flood"
wait(9)
msg.Text = "You have 60 seconds to build"
wait(9)
wait(60)
function Flood()
    game.Workspace.Flood.Size = Vector3.new(518, 22, 521)
game.Workspace.Flood.CFrame = CFrame.new(Vector3.new(-1,10,-2.5))
end

Flood()
wait(20)


function AntiFlood()
game.Workspace.Flood.Size = Vector3.new(10, 5, 10)
game.Workspace.Flood.CFrame = CFrame.new(Vector3.new(-1,-42,-2.5))
msg.Text = "You lived!"
end


AntiFlood()
end
return

It is supposed to display a message on a gui but it isn't working and it also isn't showing any output. Anyone has any idea what I did wrong here?

1 answer

Log in to vote
0
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
8 years ago

Changing something inside the StarterGui will not change it for all of the players. Instead, you can create a function to display a message for all of the players:

function Display(msg)
    for _,v in pairs(game.Players:GetPlayers())do
        local x=v.PlayerGui:FindFirstChild("Ticker")
        if x then
            x=x:FindFirstChild("Ticker")
            if x then
                x=x:FindFirstChild("TextLabel")
                if x then
                    x.Text=msg
                end
            end
        end
    end
end
function Flood()
    game.Workspace.Flood.Size = Vector3.new(518, 22, 521)
    game.Workspace.Flood.CFrame = CFrame.new(Vector3.new(-1,10,-2.5))
end
function AntiFlood()
    game.Workspace.Flood.Size = Vector3.new(10, 5, 10)
    game.Workspace.Flood.CFrame = CFrame.new(Vector3.new(-1,-42,-2.5))
    Display("You lived!")
end
while true do
    wait(6)
    Display("Disaster: Flood")
    wait(9)
    Display("You have 60 seconds to build")
    wait(9)
    wait(60)
    Flood()
    wait(20)
    AntiFlood()
end
0
How do I put that inside a script? BringMeTacos 20 — 8y
0
Is that like a "how to use a computer" question? I'm not sure what you mean there. 1waffle1 2908 — 8y
0
Like where should I add that part of the code inside the script. BringMeTacos 20 — 8y
0
edited 1waffle1 2908 — 8y
0
Thank you! BringMeTacos 20 — 8y
Ad

Answer this question