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