Tool deleting itself

Hi. I want to make custom tool holding and i made it. but there is problem. When i use tool and after few seconds i saw tool deleting itself. I dont know why its hapenning. There is a local script in my tool. Here is:

local m6d
local anim
local char
local tool = script.Parent
tool.Equipped:Connect(function()
	char = script.Parent.Parent
	repeat
		wait()
	until char.Name  ~= "Backpack"
	local a = char.RightHand
	local weld = a.RightGrip
	m6d = Instance.new("Motor6D")
	m6d.Parent = char:FindFirstChild("RightHand")
	m6d.Name = "RightGrip"
	m6d.Part0 = weld.Part0
	m6d.Part1 = weld.Part1
	weld:Destroy()
	anim = char.Humanoid:LoadAnimation(script.PhoneHoldingAnimation)
	anim:Play()
end)

tool.Unequipped:Connect(function()
	anim:Stop()
	m6d:Destroy()
end)

i thought destroy command deleting, but it only deletes weld, not tool. In my code it creates a motor6d and deletes old weld. And then plays animation

Here is the video tool deleting itself

the change dont replicate to server, try move the code to script

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.