Can't destroy one item

so i have this script:

local weapon = script.Parent
local enabled = true
local dazed = game.ServerStorage.KatanaDiversity.Dazed2
local rdazed = game.ServerStorage.KatanaDiversity.RevertedDazed
local Char = weapon.Parent.Parent
local RootPart = Char.HumanoidRootPart

local char = script.Parent

local katana = script.Parent
local wielder = script.Parent

local CanSpark = false

local katana  = script.Parent.Parent
local Origin = katana.RayParent
local baseplate = game.Workspace["Terrain'n stuff"].Baseplate
local Sparks = game.ServerStorage.KatanaDiversity.SparksEmitter

IL = {}

table.insert(IL,baseplate)
for _,V in pairs(katana:GetDescendants())do
	table.insert(IL,V)
end
for _,V in pairs(katana.Parent:GetDescendants())do
	table.insert(IL,V)
end

local function RayTest()
	local RAY = Ray.new(Origin.Position,Origin.CFrame.LookVector*3.284)
	local RayPos,HitPos = workspace:FindPartOnRayWithIgnoreList(RAY, IL, false, true)
	print(RayPos)
	if RayPos then
		if RayPos.Parent.Name == "Katana" or RayPos.Parent.Name == "LeftHand" or RayPos.Parent.Name == "RightHand" then
			local spark = Sparks:Clone()
			spark.Position = HitPos
			spark.Parent = workspace
			print("Sparks!")
			wait(1)
			print("Sparks Disabled!")
			spark.LongSparks.Enabled = false
			spark.MediumSparks.Enabled = false
			spark.ShortSparks.Enabled = false
			wait(1)
			spark:Destroy()
			print("Sparks Ded!")
			print("asd")
			if game.workspace:FindFirstChild("SparksEmitter")then
				print("asdw")
				game.workspace:FindFirstChild("SparksEmitter"):Destroy()
			end
		end	
	end
end

weapon.Touched:Connect(function(part)
	RayTest()
	if part.Parent:FindFirstChild("Humanoid") then
		local humanoid = part.Parent:FindFirstChild("Humanoid")
		local Moves = humanoid.Parent:FindFirstChild("CurrentMove")
		if Moves then
			if Moves:FindFirstChild("UpMid") then
			else
				if enabled == true then
					enabled = false
					local humanoid = part.Parent:FindFirstChild("Humanoid")
					humanoid:TakeDamage(script.Dmg.Value)
					local Efect = dazed:Clone()
					Efect.Parent = humanoid.Parent
					wait(1)
					if workspace:FindFirstChild("SparksEmitter")then
						wait(2)
						workspace:FindFirstChild("SparksEmitter"):Destroy()
					end
					script:Destroy()
				end
			end
		end
	end
end)

what i want to do is destroy that SparksEmitter from local spark = Sparks:Clone()
however it won’t destroy. Can someone tell me what am i doing wrong

Tem

3 Likes

Is this a normal script or a local script?

it’s a script
@sleepingfoxXD
(30 characters )

Maybe is because this? Could you detail if the script gives any error? Are all the print() executing or there is one missing?

theprints that are working are
Sparks!

and it shouldn’t be because of that destroy

That means that the script destroys, has an error or stops before deleting the Sparks, you should check that.

ok
(3 0 c h a r a c t e r s .)

But, why are you doing that script:Destroy()? It is not necessary (I think) and Is probably the fault of the script not working at all.

why destroy?
because i have multiple scripts that are doing about the same thing but slightly different, and i don’t want them to overlap each other

i deleted Destroy() and now it gives the Sparks Disabled!, but no Sparks Ded!

Thats probably because the Sparks are being deleted in this part of the script, before being deleted on the other part of the script.

I recommend you redoing your script and tidying it a little bit, also, if you have more than one script doing similar things, try to mix them together.

lemme explain
the similar scripts don’t have incorporated the sparks thing yet