Text Isn't working properly from script to script

Hey, I was following a Youtube video for a rounds system (30 seconds roumd, then 10 second intermission, etc.), and the round system works, but the text from one script to the other doesn’t. The text doesn’t work in the localscript, not forwarding it to the GUI.
Here are the scripts:

Rounds Script (Script)

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
--VAIRABLES
local requiredPlayers = 1

local roundLength = 10
local intermissionLength = 15

local statusText = ""
local statusUpdate = ReplicatedStorage:WaitForChild("StatusQuo")

local function waitForPlayers()
	print("Line 13")
	statusText = "The game will start soon!"
	
	repeat
		print("Line 17")
		task.wait(1)
		statusUpdate:FireAllClients(statusText)
		
	until #Players:GetPlayers() >= requiredPlayers
end

local function startRound()
	print("RoundBegun")
end

local function endRound()
	print("RoundEnded")
end
while true do
	--INTERMISSION
	for i = intermissionLength, 0, -1 do
		statusText = "Game in Progress.. (" ..tostring(i)..")"
		statusUpdate:FireAllClients(statusText)
		task.wait(1)
	end
	
	waitForPlayers()
	startRound()
	
	--GAMEROUND
	for i = roundLength, 0, -1 do
		statusText = "Game In Progress v.2 ("..tostring(i)..")"
		task.wait(1)
		
	end
	endRound()
end

LocalScript in GUI:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local statusText = script.Parent:WaitForChild("StatusText")

ReplicatedStorage:WaitForChild("Statustext").OnClientEvent:Connect(function(text)
	
	text.Text = statusText
	
end)

Output when fired:


Explorer:
image

I also don’t exactly know where to go for the infinite yield fix so if anyone knows that, that would be great! Thanks.

1 Like

the issue here is simply that there is nothing called “StatusText” in your gui. You are using waitforchild meaning it will wait until it finds something called “StatusText” but it never will because you never made it. It seems that you do have the label in your gui, but its called TextLabel. So, either id rename the text label to StatusText or change your code to wait for TextLabel instead.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.