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)
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