I Have A Regenaration Code For A Humanoid And Everytime It Dies It Regenarates, But I Need Help With Being Able To Make It So That When A Player Kills It, It Gives The Players A Certain Amount Of A Leaderboard Values, I Don't Know To Much About Leaderboards But I Know That I Called The Value "Points". Heres The Code Right Now:

local Save = script.Parent:Clone()

Save.Parent = game.ServerStorage

 

local regenTime = 60

local messageTime = 2.5

 

local model = script.Parent

local message = Instance.new("Message")


function IsDead() 

    if model.Humanoid.Health <= 0 then

        return true

        else return false

    end

end

 

while true do
    if IsDead() then
        message.Parent = game.Workspace
        wait(1)
        message.Parent = nil 
        wait(1)
        -- respawn the dead character
        local GetBackup = Save:Clone()
        GetBackup.Parent = game.Workspace
        break -- braking the loop
    end
    wait(0)
end

model.Parent = nil 

Any Answers As To How I Add The Leaderboard Value?

2 comments

0

Those Caps Though

0

I Know, I Can't Help It :)