How would I make a respawn timer

Hi!

I’m trying to make a respawn timer for when a player resets their character. When you click the reset button, A BillboardGui would show above the characters head with a timer, Games that have this are Maple County & Emergency Response: Liberty County. Wondering if somebody could help me get started.


Sorry The Clip Is Laggy

Games Mentioned

Emergency Response: Liberty County
Maple County

Make a billboard gui and when the player dies add it to their character and with a for loop you change the ui like

for i = game.Players.RespawnTime, 0, -1 do
 ui.Time.Text = i
end

How would I make it so that the player doesn’t die?

Oh sorry, I misread it.

You can use StarterGui:SetCore() to do it
something like

local StarterGui = game:GetService("StarterGui")

local timerRemote = nil -- a remote event so the timer replicates to the server, add it here
local callback = Instance.new("BindableEvent") -- since reset button callback has to be a bindable event

callback.Event:Connect(function()
 timerRemote:FireServer()
end)

local attempts = 3
local success, result
repeat
 success, result = pcall(StarterGui.SetCore, StarterGui, "ResetButtonCallback", callback)
 if not success then
  attempts -= 1
  print("Failed to set reset callback:", result)
  task.wait(2)
 end
until attempts == 0 or success
1 Like

It works! Thank you so much for your help!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.