Hello friends,
I am trying to make a timer system, where it will count from 30 seconds to 0. (All players will see the current countdown of the server. Like a server script.)
Once the timer is 0, it will print something.
Does anyone know, how could i make something like this? - Thanks
But how the time for everyone is the same?
If someone join the game, while someone is already playing, they will have different time
Make it a server script that fires a remote event to client to change text or loops through players and changes text
@iekqg @ItzBloxyDev
This won’t change the text of the Lable until the timer reaches 0, no need for if statement after while loop, no need to use while loops at all, use renderStepped or Heartbeat and calculate time using DeltaTime.
do you want the timer to be in a local script or a server script?
Hints are easy to use but they look ugly and are deprecated:
local banner = Instance.new("Hint")
banner.Parent = workspace
for t = 30, 0, -1 do
banner.Text = i
wait(1)
end
-- do something
If you plan to use a text label you would have to use a remote event to sync everyone’s banners to show the same time.
It’s not recommended to use a Remote event for any of this. Remotes are only required for TextBoxes.
Here’s the message replacement from BaseAdmin:
function notifyplayersystemmessage(msg, plrname, customTime, makeSound, hintmode, forceError)
if not plrname then warn("Message not sent; did not get plrname variable!") end
local plr
if typeof(plrname)=="Instance" then
plr = plrname
plrname = plrname.Name
end
plr = plr or game.Players:FindFirstChild(plrname)
if not plr then return end
local old = plr.PlayerGui:FindFirstChild("Notify")
if old then old:Destroy()end
local gui = Instance.new("ScreenGui")
gui.IgnoreGuiInset=true
--gui.ResetOnSpawn=false
gui.Name = "Notify"
gui.DisplayOrder = 2
local txt = Instance.new("TextLabel")
txt.TextColor3=Color3.fromRGB(255, 255, 255)
txt.BackgroundTransparency = 0.5
txt.BackgroundColor3 = Color3.new()
txt.Text = msg
txt.TextSize = 12
txt.RichText = true
txt.TextWrapped = true
if hintmode then
txt.Size = UDim2.new(1, 0, 0, 30)
else
txt.Size=UDim2.fromScale(1, 1)
end
txt.Parent = gui
gui.Parent = plr.PlayerGui
game:GetService("Debris"):AddItem(gui, customTime or 6)
if makeSound then
if makeSound == "random" then
local t = {}
for _, obj in pairs(script.Sounds:GetChildren()) do
if obj:IsA("Sound") then
table.insert(t, obj)
end
end
makeSound = t[math.random(1, #t)].Name
end
local ding = script.Sounds:FindFirstChild(makeSound)
if ding then
ding = ding:Clone()
else
ding = script.Sounds.notify:Clone()
end
ding.Parent = plr.Backpack
local notifyScript = script.LocalNotify:Clone()
notifyScript.Parent = ding
if makeSound=='e' or forceError then
txt.BackgroundTransparency = 0
ding.Name = "Error"
if forceError then
ding.Name = "fError"
end
end
end
return txt, gui
end
I think a hint is necessary. Roblox should consider updating them.