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

How do I make it so that when I kill a humanoid, it drops 3 tools?

Asked by 8 years ago

I want to make a script that drops 3 copies of the SAME tool when I kill the humanoid. Problem: The dummy is not dropping the 3 tools I want it to.

local dummy = script.Parent 
local dummy2 = dummy:clone() 
backup = dummy
log = game.ReplicatedStorage.Tool


local humanoid = backup:FindFirstChild("Humanoid") 

if humanoid then 
    humanoid.Died:connect(function() 
        wait(5)
        dummy:Destroy() 
        dummy2.Parent = workspace 
        dummy2:MakeJoints() 
        log:Clone()
        log:Clone()
        log:Clone()
    end)
end

2 answers

Log in to vote
1
Answered by 8 years ago
Edited 8 years ago

You could use a loop to spawn multiple tools. You also need to set the tool's parent to workspace, and set its starting position to see it. For example, I set the tool's starting position to the dummy's torso position.

local dummy = script.Parent 
local dummy2 = dummy:clone() 
backup = dummy
log = game.ReplicatedStorage.Tool


local humanoid = backup:FindFirstChild("Humanoid") 

if humanoid then 
    humanoid.Died:connect(function() 
        wait(5)
        dummy:Destroy() 
        dummy2.Parent = workspace 
        dummy2:MakeJoints() 
    for i=1,3 do
        local clonedTool = log:Clone()
        clonedTool.Parent = workspace
        clonedTool.Handle.Position = dummy.Torso.Position
    end
    end)
end
0
Thanks, it worked! :) ReynaldoVictarion 70 — 8y
Ad
Log in to vote
0
Answered by 8 years ago

an easier way to do it is by going to linkedsword and check can drop weapon

Answer this question