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

How Do I Make A Humanoid Give Leaderboard Values? [closed]

Asked by 9 years ago

I Have This Regenaration Code For My Zomibes(Humanoid) And Towards The End Of The Code I Need It To Give The Person Who Slays The Zombie A Certain Amount Of Points(Leaderboard Values)

But I Just Cant Figure It Out!

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 

Anyone Have Any Solutions? Because I'm Kinda New To Lua.

0
Why Must People Down Vote My Question And Not Even Atempt An Anwser? So Rude! MarioMarMan 0 — 9y
0
Well, you could of looked it up on google and the roblox wiki. There is even a search bar on the top of the page. EzraNehemiah_TF2 3552 — 9y

Closed as Not Constructive by Goulstem and evaera

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?

1 answer

Log in to vote
0
Answered by 9 years ago
  • Use the died event to see if someone died
  • MakeJoints
  • Add a leaderstat
  • Creator tag


Died Event

The died event sees if a humanoid's health depletes to 0, as seen in this script!

workspace.LordDragonZord.Humanoid.Died:connect(function()
    print("Oh no! LordDragonZord Died!")
end)

!DiedEvent


Fun Fact about Died Event

  1. A player dies if the head and torso get disconnected or just by plain old damage.


MakeJoints

MakeJoints is a function that sees if a player has any welds and connects parts together. Use this so the body doesn't break

workspace.Zombie:MakeJoints()

!Zombie


Fun Facts about Make Joints

  1. It has a counterpart, break joints, it disconnects all welds.


Leaderstats

http://wiki.roblox.com/index.php?title=Leaderboard



Tag

http://wiki.roblox.com/index.php?title=Tools#Damage




Final Product

local zombie = workspace.Zombie
local h = zombie:FindFirstChild("Monster") --Or humanoid
local clone = zombie:clone()

if h then
    h.Died:connect(function()
        wait(60) --1 minute
        clone.Parent = workspace
        clone:MakeJoints()
    end)
end

This script isn't a good script, it isn't finished either! You need to use what you learned to make a finished script! (Add the leaderstat point rewarder!)





Hope this helps! !LordDragonZord

0
yes this helps but one last question, where in there do i add the leader stats? after the function or... MarioMarMan 0 — 9y
Ad