Making a system that checks through all BoolValues in a Part, and then make it do stuff when the BoolValue is true. That part works, but The bottom section of the code can’t find the global variables “Shinyexplosion”, “Fexplosion”, “ShinyClone”, or “FireClone” that are located in the if statements.
if descendantShiny.Value == true then
Sexplosion = game.Workspace.ParticleFolder.ShinyExplosion:Clone()
Sexplosion.Parent = DescendantReplace
Sexplosion.Enabled = true
ShinyClone = game.Workspace.SoundFolder.ShinyGrab:Clone()
ShinyClone.Parent = game.Workspace.SoundFolder
ShinyClone:Play()
end
if descendantFire.Value == true then
Fexplosion = game.Workspace.ParticleFolder.FireExplosion:Clone()
Fexplosion.Parent = DescendantReplace
Fexplosion.Enabled = true
FireClone = game.Workspace.SoundFolder.FireGrab:Clone()
FireClone.Parent = game.Workspace.SoundFolder
FireClone:Play()
end
wait(0.5)
Sexplosion.Enabled = false
Fexplosion.Enabled = false
ShinyClone:Destroy()
wait(0.3)
FireClone:Destroy()
wait(1.2)
SClone:Destroy()
I’ve tried looking over the DevForums but I can’t find anyone with a similar problem. Any help is appreciated! The error I get is: attempt to index nil with ‘Enabled’