I have a pan, and when you hold it, and then click, an animation plays.
But when you un equip it, it still plays when you click.
Can anyone help?
local mouse = player:GetMouse()
local AnimationId = "rbxassetid://5009868932" -- use your animation id
local debounce = true
script.Parent.Equipped:Connect(function()
mouse.Button1Down:Connect(function()
local Humanoid = player.Character.Humanoid
if mouse.Button1Down and debounce == true then
debounce = false
local Animation = Instance.new("Animation")
Animation.AnimationId = AnimationId
local LoadAnimation = Humanoid:LoadAnimation(Animation)
local sd = script.Parent.Sound2
LoadAnimation:Play()
wait(1)
Animation:Destroy()
debounce = true
script.Parent.Handle.Touched:Connect(function(hit)
if hit.Name == "HumanoidRootPart" or hit.Name == "Torso" then
sd:Play()
end
end)
end
end)
end)