I want to make this script work when a player kill a player and then they receive an item such as coins and others from the dead person and if the killer do not pick up the item, then it will disappear. How am I going to do that?
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 comment
You are removing the script before it can finish what you're trying to do.