You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
I want the winner UI (WinnerLabel
) to display on the screen when a player wins a round
- What is the issue? Include screenshots / videos if possible!
The UI doesn’t appear on the screen, even though the event prints correctly in the output. The label is visible in Roblox Studio, and no errors are shown
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
- Checked that
WinnerLabel
exists in the UI and is set to visible in studio - Confirmed
ResetOnSpawn = false
on the ScreenGui - Verified the event is firing and prints the winner in the output
- Checked
TextTransparency
andBackgroundTransparency
are both 0 - Confirmed the UI is parented to PlayerGui
- Tried forcing visibility using
winnerLabel.Visible = true
Here’s the relevant client side script that handles the UI:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RoundStatusEvent = ReplicatedStorage:WaitForChild("RoundStatusEvent")
local FlagEvent = ReplicatedStorage:WaitForChild("FlagEvent")
local ui = script.Parent
local roundStatusLabel = ui:FindFirstChild("RoundStatus")
local flagHolderLabel = ui:FindFirstChild("FlagHolderLabel")
local winnerLabel = ui:FindFirstChild("WinnerLabel")
local function updateRoundStatus(status, timeLeft, gameMode)
if roundStatusLabel then
if status == "Intermission" then
roundStatusLabel.Text = "Intermission: " .. timeLeft .. "s\nNext Mode: " .. gameMode
if flagHolderLabel then flagHolderLabel.Text = "" end
if winnerLabel then winnerLabel.Text = "" end
elseif status == "RoundStarting" or status == "RoundInProgress" then
roundStatusLabel.Text = "Mode: " .. gameMode .. "\nTime Left: " .. timeLeft .. "s"
elseif status == "RoundEnded" then
roundStatusLabel.Text = "Round Over! Restarting..."
end
end
end
local function updateFlagHolder(playerName)
if flagHolderLabel then
flagHolderLabel.Text = " " .. playerName .. " has the flag!"
task.spawn(function()
task.wait(3)
flagHolderLabel.Text = ""
end)
end
end
local function announceWinner(playerName)
if winnerLabel then
print("Winner announcement received for:", playerName)
winnerLabel.Text = "Winner: " .. playerName .. "!"
winnerLabel.Visible = true
task.wait(5)
winnerLabel.Visible = false
end
end
RoundStatusEvent.OnClientEvent:Connect(updateRoundStatus)
FlagEvent.OnClientEvent:Connect(function(eventType, data)
print("Client received event: ", eventType, data)
if eventType == "FlagHolder" then
updateFlagHolder(data)
elseif eventType == "FlagWinner" then
print("Announcing Winner:", data)
announceWinner(data)
end
end)
And here’s the server-side script that fires the event:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ShowBannerEvent = ReplicatedStorage:FindFirstChild("ShowBannerEvent") or Instance.new("RemoteEvent", ReplicatedStorage)
ShowBannerEvent.Name = "ShowBannerEvent"
local function announceWinner(flagHolder)
if flagHolder then
print("FlagWinner event fired for:", flagHolder.Name)
ShowBannerEvent:FireAllClients(flagHolder.Name)
end
end