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

How to make a "survived time" timer?

Asked by 4 years ago

I am making a game where the objective is to survive the longest. I do not even know where to start for making a script that starts a timer for every player and then the timer stop for a player when they have died or they are the last one standing.

I thought of using remote event, however I relised it would be impractical.

1 answer

Log in to vote
-1
Answered by 4 years ago

I think I found out a way to make this: Put a local script in StarterCharacterScripts and name it whatever you want. Create a NumberValue in the workspace and name it SurviveTime

local Humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
local Timer = game.Workspace.SurviveTime

while true do
    for i=1, 1, 1 do
        if Humanoid.Health >= 1 then
            Timer.Value = Timer.Value+1
        else
            Timer.Value = Timer.Value+0
        end
    end
end

Hope this helps! Leave a comment if there is anything wrong or anything I should add.

0
N o. This code is full of redundancies and serious contradictions. Ziffixture 6913 — 4y
0
I dont know what that means MarcTheRubixQb 153 — 4y
Ad

Answer this question