A gui appears for everyone in server when the countdown ends

Heyo Developers! I was wondering how I could make a gui appear for everyone in the server when the countdown ends! It’m kind of confused, help are appreciated!

local day = 1630453080

--(offical date: 1633752000)--

local EventTime = workspace.CountdownTime.timePart.TimeGui.TimeText

local tS = game:GetService("TweenService")

local CS = game:GetService("CollectionService")

local sparklerParts = CS:GetTagged("Sparkler")

local confettiParts = CS:GetTagged("Confettis")

local rep = game.ReplicatedStorage

local tinkerbell = rep:WaitForChild("TinkerBell")

local tinkerAnim = tinkerbell:WaitForChild("PlayAnimation")

local transparencyGoal = { 
	Transparency = 0
}

local openGoal = {
	Position = Vector3.new(9.5, 65.051, -5.147)
}


while wait() do
	--local currentTime = os.time()

	--[[if currentTime >= EventStop then
		break
	end]]--

	--[[if currentTime >= EventStart then
		EventTime.Text = "Happy Birthday CyclopsArt!"
		break]]--

	--	else
	local secondbetween = os.difftime(day, os.time())
	--	local secondsleft = EventStart - currentTime
	local month = math.floor(secondbetween % (60*60*24*30*365)/ (60*60*24*30))
	local days = math.floor(secondbetween % (60*60*24*30) / (60*60*24))
	local hours = math.floor(secondbetween % (60*60*24) / (60*60))
	local minutes = math.floor(secondbetween % (60*60) / 60)
	local seconds = secondbetween % 60

	local dhms = string.format("%02i", month).. ":" ..string.format("%02i", days) .. ":" .. string.format("%02i", hours) .. ":" .. string.format("%02i", minutes) .. ":" .. string.format("%02i", seconds)

	EventTime.Text = dhms

	if secondbetween <= 0 then
		EventTime.Text = "Happy Birthday!"

		for _, spark in pairs(sparklerParts) do
			spark.Enabled = true
			
			tinkerbell.Parent = game.Workspace
			tinkerAnim.Disabled = false
			wait(30)
			tinkerbell.Parent = rep
			tinkerAnim.Disabled = true
			tinkerbell:Destroy()

			
		end
		break
	end
end

A good question! We can use a RemoteEvent to fire a signal to all the clients (players) currently in the game. You can then connect an event listener within your interface logic and perform a certain task. For example, showing a message or opening a frame.

The request is sent from the server and respectively recieved on the client.

Example

Server Counterpart:

local RemoteEvent = game:GetService("ReplicatedStorage").InterfaceEvent

-- this would be within your loop or function somewhere
-- essentially the instant you need to show the screen, you should fire all clients
RemoteEvent:FireAllClients("ShowRoundResults")

Client Counterpart:

local RemoteEvent = game:GetService("ReplicatedStorage").InterfaceEvent

RemoteEvent.OnClientEvent:Connect(function(Request)
    if Request == "ShowRoundResults" then
           --show results screen
    end
end)
1 Like

Do you know why it gave this error?
image

Oh silly error! Change .OnServerEvent to .OnClientEvent in the client script. Today was a long day! :laughing:

1 Like

Dw! It’s fine, this is a common problem I should’ve noticed sorry!

Is your game now showing a result or frame when you :FireAllClients()?

1 Like

Nothing happened, huh-

Local Script:

local RemoteEvent = game:GetService("ReplicatedStorage").FireTinkerBellDialog

RemoteEvent.OnClientEvent:Connect(function(Request)
	if Request == "ShowRoundResults" then
		script.Parent.TextLabel.Visible = true
	end
end)

Server Sided in ServerScriptService:

		EventTime.Text = "Happy Birthday!"

		for _, spark in pairs(sparklerParts) do
			spark.Enabled = true
			
			tinkerclone = tinkerbell:Clone()
			tinkerclone.Parent = game.Workspace
			tinkerAnim.Disabled = false
			RemoteEvent:FireAllClients("ShowRoundResults")
			wait(30)
			tinkerclone.Parent = rep
			tinkerAnim.Disabled = true
			tinkerclone:Destroy()

			
		end
		break
	end
1 Like

Have you made a RemoteEvent object and placed it inside of ReplicatedStorage?

1 Like

Make sure the ScreenGui (and frame if there’s any) are also Enabled/Visible or it will not show.

Yes! I have, the text is not showing for some reason

Also, to see if there’s any reported errors you should view the output.

1 Like

Have you also checked what @Sarchyx has suggested?

1 Like

Yes! Got it! Thank you @Sarchyx and @Nidoxs !