Object does not get destroyed

So i have this modulescript that creates an attachment with particles but for someone it doesn’t get deleted

local GojoVFX = {
	["ReversalRed"] = function(PathData)
		local Character = PathData.Character
		local Humanoid = Character:FindFirstChild("Humanoid")
		local HRP = Character:FindFirstChild("HumanoidRootPart")
		
		local Task = PathData.Task
		
		local RedBall = Assets.ReversalRed.Part.RedBall:Clone()
		local ReversalBeam = Assets.ReversalRed.Beam:Clone()
		
		if Task == "Summon" then
			RedBall.Parent = Character:FindFirstChild("Right Arm")
		elseif Task == "Destroy" then
			RedBall:Destroy()
		elseif Task == "Fire" then
			ReversalBeam:SetPrimaryPartCFrame(PathData.Direction * CFrame.Angles(0, 0, math.rad(math.random(-180,180))))
			ReversalBeam.Parent = PathData.Character
			for i, v in pairs(ReversalBeam:GetDescendants()) do
				if v:IsA("BasePart") then
					TweenService:Create(v, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut),{
						Transparency = 1,
						Size = Vector3.new(v.Size.X, v.Size.Y * 1.5, v.Size.Z * 1.5)
					}):Play()

				elseif v:IsA("SurfaceLight") then

					TweenService:Create(v, TweenInfo.new(0.25),{
						Range = 0,
						Brightness = 0
					}):Play()
				end
			end
			Debris:AddItem(ReversalBeam, .25)
		end
	end,
}

return GojoVFX

Thanks in advance.

You destroy the redball clone but never the original ball.

1 Like

Idk if it’s related or not but doing “Character:FindFirstChild(“Right Arm”).RedBall:Destroy()” works, how?
Isn’t it like just the same as doing “RedBall:Destroy()”?

Its because “Character:FindFirstChild(“Right Arm”).RedBall:Destroy()” is finding the RedBall instance, rather than “RedBall:Destroy()” which is technically “local RedBall = Assets.ReversalRed.Part.RedBall:Clone():Destoy()” (incorrect code but its just so you understand)

1 Like

ty i understand now, but is there any better way of doing it other than “Character:FindFirstChild(“Right Arm”).RedBall:Destroy()”?

Instead of

local RedBall = Assets.ReversalRed.Part.RedBall:Clone()
local ReversalBeam = Assets.ReversalRed.Beam:Clone()

Do

local RedBall = Assets.ReversalRed.Part.RedBall
local ReversalBeam = Assets.ReversalRed.Beam
RedBall:Clone()
ReversalBeam:Clone()
1 Like

Ty but it didn’t work, if there is no other way imma just stick to using "Character:FindFirstChild(“Right Arm”).RedBall:Destroy()”, not a big deal ig.

Oh, sorry. If you want to delete the cloned part do

local RedBall = Assets.ReversalRed.Part.RedBall
local ReversalBeam = Assets.ReversalRed.Beam
local RedBallClone = RedBall:Clone()
local ReversalBeamClone = ReversalBeam:Clone()

And that lets you destroy both the clone and the original

RedBall:Destroy()
RedBallClone:Destroy()
ReversalBeamClone:Destroy()
ReversalBeam:Destroy()

Also realized i was a bit wrong.
local RedBall = Assets.ReversalRed.Part.RedBall:Clone() does not clone the part everytime you index it, but you just cant access the original part, so this infact should also work.

RedBall = Assets.ReversalRed.Part.RedBall
RedBallClone = Assets.ReversalRed.Part.RedBall:Clone()
1 Like

Ty but doing the other way is just simpler, but i’m still going to mark your answer as the solution

1 Like

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