Upon respawning, the Local-script breaks due to the debounce

(EDIT: Hello, I’ve somehow fixed the issue on why its happening, it’s apparently of a Ragdoll Death script, yeah, it’s embarrassing)
Hello Developers!

I’ve created a weapon that for some reason breaks whenever you respawn. It has to do something with the debounce script which I manage to know why is that if I remove the debounce line (And whenever the humanoid of the wielder is stun), the weapon works with the exception of the idle animation not playing for some whatever reason. I don’t know what is causing this issue.

--//Tool\\--
local FireExtinguisher = script.Parent
--//Player\\--
local Player = game.Players.LocalPlayer
local Char = Player.Character or Player.CharacterAdded:Wait()
--//Services\\--
local ReplicatedStorage = game:GetService("ReplicatedStorage")
--//Connections\\--
local Debounce = false
FireExtinguisher.Activated:Connect(function()
	if not Debounce and Char.Humanoid.PlatformStand == false then
		Debounce = true
		FireExtinguisher.AttackEvent:FireServer()
		task.wait(5)
		Debounce = false
	end
end)
FireExtinguisher.Equipped:Connect(function()
	ReplicatedStorage.ConnectM6D:FireServer(FireExtinguisher.BodyAttach)
	Char.Torso.ToolGrip.Part0 = Char.Torso
	Char.Torso.ToolGrip.Part1 = FireExtinguisher.BodyAttach
	local IdleAnim = FireExtinguisher.Parent.Humanoid:LoadAnimation(FireExtinguisher.Idle)
	IdleAnim:Play()
	FireExtinguisher.Unequipped:Connect(function()
		ReplicatedStorage.DisconnectM6D:FireServer(FireExtinguisher.BodyAttach)
		IdleAnim:Stop()
	end)
end)
1 Like