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

Making A Scoreboard that keeps counting until you die?

Asked by 5 years ago

I'm trying to figure out how to make a scoreboard that doesn't stop counting until you die.

wait()
local a = 0
local c = script.Parent.Text

game.Players.PlayerAdded:connect(function(p)
    p.CharacterAdded:connect(function(char)
        if char:FindFirstChild("Humanoid").Health >= 100 then
            while true do
                a = a+1
            c = "High Score: "..a
            end
        elseif char:FindFirstChild("Humanoid").Health == 0 then
            script.Parent.Text = a
        end
    end)
end)

2 answers

Log in to vote
0
Answered by
Leamir 3138 Moderation Voter Community Moderator
5 years ago
Edited 5 years ago

Hello, SnakeInTheBoots!

I made some little changes in your script:

wait()
local a = 0
local c = script.Parent.Text

game.Players.PlayerAdded:connect(function(p)
    p.CharacterAdded:connect(function(char)
        if char:FindFirstChild("Humanoid").Health >= 100 then
            while true do -- I think you forgot a wait() somewhere here....
                a = a+1
            c = "High Score: "..a
            if char.Humanoid.Health == 0 then break end -- Breaks the Loop if the health is equals to 0
            end
    -- Removed some not needed lines...
    script.Parent.Text = a
    end)
end)

Good Luck with your games

0
You should explain your answer. Otherwise, OP won't learn anything. lunatic5 409 — 5y
Ad
Log in to vote
-1
Answered by 5 years ago
--make sure it is a local script and in the right place to fit "c"
--shouldn't be in workspace

wait()
local a = 0
local c = script.Parent.Text
local plr = game.Players.LocalPlayer
repeat wait()until plr.Character
repeat
    a = a + 1
    wait(1) -- number of seconds to wait until 1 is added to a
    c = "High Score" ..a -- I don't understand but you're making the script so we'll keep it
until plr.Character.Humanoid.Health == 0
script.Parent.Text = a

-- please tell me if it doesn't work and I'll try improving it
0
doesn't work :( SnakeInTheBoots 54 — 5y
0
nvm I got it to work.. SnakeInTheBoots 54 — 5y
0
This is a little bit fake, it don`t updates to the server the count, so it just gives the result to the local player... You NEED to use Remote Functions or a Server Script Leamir 3138 — 5y

Answer this question