Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Making countdown on Screen
- -- Add RemoteEvent in ReplicatedStorage
- -- ServerScriptService
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local countdownEvent = ReplicatedStorage:WaitForChild("CountdownEvent") -- RemoteEvent
- local secondRemaining = 20
- for count = secondRemaining, 1, -1 do
- countdownEvent:FireAllClients(count)
- wait(1.0)
- end
- -- LocalScript in ScreenGUI
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local countdownEvent = ReplicatedStorage:WaitForChild("CountdownEvent") -- RemoteEvent
- -- Get the ScreenGui and the TextLabel
- local screenGui = script.Parent
- local countDisplay = screenGui.ShowCountdown
- local function onTimerUpdate(count)
- -- Set the TextLabel to match the incoming count
- countDisplay.Text = count
- end
- -- Call "onTimerUpdate()" when the server fires the remote event
- countdownEvent.OnClientEvent:Connect(onTimerUpdate)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement