Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I make a working lives gui? I can't seem to have the numbers count down on death.

Asked by 7 years ago
Edited 7 years ago

For a game of mine, iv'e been wanting to make a lives gui like the one from the Roblox game: Super Chekpoint. Iv'e tried, but I just cant get it to work, can you maybe include some code that would do that? Create a gui and a number gui and that number would count down upon death, until it 0 lives are left. Game over screen is optional. Here's my code.

game.Players.PlayerRemoving:connect(function(reset)
    local player
    local dead
    local LivesNum
    local Lost
    local Lives
    if player(dead) then
        LivesNum = (Lost)
        Lost = (1)
        Lives = (25)
    end
    Lives = (25)
end)
0
Code? We can't help without your attempted code. Sorry! starlebVerse 685 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

You're not using the right event!

You're looking for Humanoid.Died() -- This'll trigger when the character dies.

You're trying to make it so when the player leaves, they lose a life.

-- || Services ||
local Players = game:GetService("Players")

-- || GettingPlayer ||
Players.PlayerAdded:connet(function(Player)
    Player.CharacterAdded:connect(function(Character)
        Character:FindFirstChildOfClass("Humanoid").Died:connect(function()

             -- Your code goes here.
end) end) end)

Best of luck! Ask questions if needed~

Ad

Answer this question