When I select the Hopperbin and I click my character punches and when I deselect the hopperbin it still punches!

UIS = game:GetService("UserInputService")
Player = game.Players.LocalPlayer
FireDebounce = true
AttackDebounce = true

script.Parent.Selected:connect(function()
	UIS.InputBegan:connect(function(board, GPE)
	if board.UserInputType == Enum.UserInputType.MouseButton1 and not GPE and FireDebounce == true then
		FireDebounce = false
		Player.leaderstats.EXP.Value = Player.leaderstats.EXP.Value + 1
		Punche = Player.Character.Humanoid:LoadAnimation(script.Punch)
		Punche:Play()
		wait(.6)
		Punche:Stop()
		PunchL = Player.Character.Humanoid:LoadAnimation(script.PunchL)
		PunchL:Play()
		wait(.5)
	    PunchL:Stop()
		local connection = Player.Character["Left Arm"].Touched:connect(TouchHit)
        wait(.5)
        connection:Disconnect()
        local connect = Player.Character["Right Arm"].Touched:connect(TouchHit)
        wait(.5)
        connect:Disconnect()
       FireDebounce = true
	end
end)
end)

script.Parent.Deselected:connect(function()
end)


2 comments

1

You didn't add any code for the animation to stop... (Lines 30-31)

1

MythicalByte, you shouldn't use HopperBins they are deprecated. Instead use a Tool and set the property RequiresHandle to false.