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

How Do I Remove Tool From The Test Dummy?

Asked by
ImfaoXD 158
8 years ago

What I'm trying to make this script do is when a player killed a test dummy. The item from the test dummy will drop on the ground, but the tool is in lighting though not in the test dummy and if the player don't pick up that item, then it will be remove in a certain amount of time. How can I do that? Can somebody help me?

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.Health <1) then 
        Drop() 
    end 
end

1 answer

Log in to vote
0
Answered by 8 years ago

Put a script inside the tool that checks to see if the tool is not inside the test dummy.

local parentName = "" -- Name of the test dummy
local count = 0

while true do
    wait(1)
    if script.Parent.Parent.Name ~= parentName then
        if count == 5 then
            script.Parent:remove()
        end
    end
end

Hope this helps :)

Ad

Answer this question