Debris deleting parent?

For whatever reason, Debris Service is deleting the parent of the hitbox… I have no idea why it would be doing this and honestly there’s a good shot I’m missing something simple but I’ve looked through my code a couple times and haven’t noticed anything out of the usual, and I’m not getting any errors either so I’m completely stumped right now. Maybe I’m misunderstanding how Debris works? Thanks in advance.

debris = game:GetService("Debris")

standardEvent.OnServerEvent:Connect(function(plr, dmg, char, curCombo, maxCombo, normKB, endComboKB, endComboStunTime)
	local plrHrp = char:WaitForChild("HumanoidRootPart")
	local plrFolder = char:FindFirstChild(tostring(plr).."CombatFolder")
	
	local hitbox = script.Combat.HitBox:Clone()
	hitbox.Parent = plrFolder
	hitbox.CFrame = (plrHrp.CFrame * (CFrame.new(0,0,-2)))
	debris:AddItem(plrFolder, .5) --The problem, I think
	
	local weld = Instance.new('WeldConstraint')
	weld.Parent = plrHrp
	weld.Part0 = plrHrp
	weld.Part1 = hitbox
	
	end)
end)

*This isn’t the entire script.

According to your code

debris:AddItem(plrFolder, .5)

You are deleting plrFolder, which is the parent of the hitbox (hence the issue)

Instead of having the folder be the parameter, try putting the hitbox as the parameter

debris:AddItem(hitbox, .5)
1 Like

I feel so dumb right now man thank you… my brain is fried im going to sleep

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