Tool destroying itself

hi i was making a mask

and when i equip it like in 5 second it destroys itself
video:


script:

repeat wait() until script.Parent.Parent:IsA("Model")
local tool = script.Parent
local char = tool.Parent
local hum = char:WaitForChild("Humanoid")
local equip = hum:LoadAnimation(tool:WaitForChild("Anims").Equip)
local UnEquip = hum:LoadAnimation(tool:WaitForChild("Anims").UnEquip)

tool:WaitForChild("MaskEvent").OnServerEvent:Connect(function(plr,bool)
	if bool == true then
		equip:Play()
		task.wait(equip.Length)
		char:FindFirstChild("Head").RoleplayName.Frame.RoleplayName.Text = "Masked"
		local mask = game:GetService("ReplicatedStorage").Mask:Clone()
		mask.Name = "mask"
		mask.Parent = char
		local weld = Instance.new("Weld",char:FindFirstChild("Head"))
		weld.Part0 = char:FindFirstChild("Head")
		weld.Part1 = mask
		weld.C0 = mask.CFrame:Inverse() * char:FindFirstChild("Head").CFrame
		tool:FindFirstChild("Handle").Transparency = 1
		for _,v in pairs(char:GetChildren()) do
			if v:IsA("Accessory") then
				v.Handle.Transparency = 1
			end
		end
	else
		local mask = char:FindFirstChild("mask")
		if mask then
			UnEquip:Play()
			task.wait(UnEquip.Length)
			char:FindFirstChild("Head").RoleplayName.Frame.RoleplayName.Text = hum.DisplayName.."(@"..plr.Name..")"
			mask:Destroy()
			for _,v in pairs(char:GetChildren()) do
				if v:IsA("Accessory") then
					v.Handle.Transparency = 0
				end
			end
			tool:WaitForChild("Handle").Transparency = 0
		end
	end
end)

please help me and its last day of school so i not gonna be here like 1 hour

2 Likes

Is the tool just disappearing (you make the Handle Transparent, so if the tool is still in your player it hasn’t disappeared.
Can you see the mask fall off your avatar and drop through the baseplate? If so then your weld isn’t working.

Put some print statements in the sections of your code like:

	if bool == true then
        print("tool equipped")
		equip:Play()
	if mask then
        print("tool equipped")
		UnEquip:Play()

the tool isn’t destroying its self. the mask is just disappearing

tool:FindFirstChild("Handle").Transparency = 1

nope its not falling off the baseplate

1 Like

i fixed it by manually welding it lol

1 Like

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