I am trying to have all the players items drop on death so another player can pick them up. This is what I have been trying and attempting to fix. I cant figure out whats wrong.

workspace.DescendantAdded:connect(function(a) if game.Players:FindFirstChild(a.Name) ~= nil then local died = false a.Humanoid.Died:connect(function() if died == false then died = true print'died' local cf = a.Torso.CFrame local p = game.Players:FindFirstChild(a.Name).Backpack:GetChildren() for i= 1, #p do if p[i].ClassName == 'Tool' and p[i]:FindFirstChild'Handle' ~= nil and a:FindFirstChild(p[i].Name) == nil then p[i].Parent = workspace p[i].Handle.CFrame = cf p[i].Handle.CanCollide = true end end

		p = a:GetChildren() 
		for i= 1, #p do 
		if p[i].ClassName == 'Hat' then p[i].Parent = workspace end
		if p[i].ClassName == 'Tool' then p[i].Parent = workspace p[i].Handle.CanCollide = true end
		end
		
		died = false
		end
		
	end)
end

end)

1 comment

0

Don't come on this site with free model code, expecting for it to be fixed.