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

Level Reset on Player Death? [closed]

Asked by 4 years ago

I am making a platformer game and I want to make the level reset every time the player dies but I am not sure how to go about it, any information is welcome!

Closed as Not Constructive by Ziffixture

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

3 answers

Log in to vote
0
Answered by 4 years ago

To answer your question a way you can go about this is make something to watch for the players death and then run code that will reset everything once they die to the point you want to.

Ad
Log in to vote
0
Answered by 4 years ago

Insert a checkpoint in the first level, so everytime they lose they spawn there, DONT add any other checkpoints

Log in to vote
0
Answered by
0msh 333 Moderation Voter
4 years ago

not a request site, but you can add a script inside of StarterCharacterScript and use a loop to check for player's health. And when the health is 0 then you get the player's level and set it to 0.

maybe something like this:

local hum = script.Parent:WaitForChild("Humanoid")
while wait() do
    if hum.Health <= 0 then
        local player = game.Players:GetPlayerFromCharacter(script.Parent)
        player:WaitForChild("leaderstats").level.Value = 0
end
end
0
there is a `Humanoid.Died` event EpicMetatableMoment 1444 — 4y
0
Use the Died event of the Humanoid to Connect a listener to this. Applying a loop is inefficient Ziffixture 6913 — 4y