ChildAdded/ChildRemoved doesn't work

So i making a stuck check script with ChildAdded and ChildRemoved. First off they was working but now it stopped. I don’t know why. Can someone help me?

Here script:

script.Parent.ChildAdded:Connect(function(part)
	if script.Parent:FindFirstChild("Stunned") then
		for i,v in pairs(script.Parent:GetChildren()) do
			if v.Name == script.Parent.Name.." hitbox" then
				v:Destroy()
			end
		end
		script.Parent.Humanoid.WalkSpeed = 0
		script.Parent.Humanoid.JumpPower = 0
	end
end)

script.Parent.ChildRemoved:Connect(function(part)
	if part.Name == "Stunned" and not script.Parent:FindFirstChild("Stunned") then
		script.Parent.Humanoid.WalkSpeed = 16
		script.Parent.Humanoid.JumpPower = 50
		local mod = require(game.ReplicatedStorage.FunctionModule)
		mod.IframeInsert(script.Parent)
	end
end)

try moving v to another parent then deleting it on child removed instead

1 Like

Thanks, it helped to my problem.

1 Like