Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What did I do wrong here?

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

✓ Accepted answer

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

5 comments

0

How do I put that inside a script?

0

Is that like a "how to use a computer" question? I'm not sure what you mean there.

0

Like where should I add that part of the code inside the script.

0

edited

0

Thank you!

This discussion is preserved as it was. New answers, comments, and votes are closed.