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

How do I create a leaderboard that give an item?

Asked by
ImfaoXD 158
8 years ago

I'm trying to make a leaderboard that give or drop item like coin that made from a "part" model when a player kill a player in the game? also if the player do not pick up the item from the dead person, then it will disappear if they do not picking the item up. How do I do that? Is it possible? An example like minecraft. When you kill a creeps or a cow they drop an item like meat and others stuff. But I want to make this script work on player, not on zombie or test dummy.

function Drop() 
local drops = {"item"} 
local G = math.random(1, 1)
local Obj = game.Lighting:findFirstChild(drops[G]):Clone() 
Obj.Parent = game.Workspace 
Obj.Handle.CFrame = script.Parent.Head.CFrame + Vector3.new(5,2,0)  
script:remove()
end 


while true do 
    wait(.1) 
    if (script.Parent.Humanoid.Player.Health <1) then 
        Drop() 
        wait(3)remove
    end 
end

1 answer

Log in to vote
0
Answered by
xuefei123 214 Moderation Voter
8 years ago

Well put a script in the humanoid doing,

local humanoid = script.Parent

humanoid.Died:connect(function()
local item = game.Lighting.Item--change that
local itemc - item:Clone()
item:MoveTo(script.Parent.Parent.Torso.Position + Vector3.new(0, 3, 0))
item.Parent = game.Workspace
end

That should work, but its the basic principle when the humanoid dies.

Ad

Answer this question