Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How Do I Make A Humanoid Give Leaderboard Values?

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.

2 comments

0

Why Must People Down Vote My Question And Not Even Atempt An Anwser? So Rude!

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.

1 answer

✓ Accepted answer
  • 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

1 comment

0

yes this helps but one last question, where in there do i add the leader stats? after the function or...

This discussion is preserved as it was. New answers, comments, and votes are closed.