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 it so that when I kill a humanoid, it drops 3 tools?

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

✓ Accepted answer

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

1 comment

0

Thanks, it worked! :)

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

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