Sounds a bit odd, right? A script basically lying to me, Anyways.
I have a module script, When you call the “Use” function on it, It will use a bindable event, And will wait a bit, Check a few things, Then wait again, check again, And delete a part that was created at the start. Works fine, until you fire the bindable before the part is deleted, in this case the part isnt destroyed, However this part just stays forever, Even after the bindable event is called after the part stays.
I am so confused, It cant be that the variable is set to nil, but the part isnt destroyed, Because the part is destroyed before the variable is even set to nothing.
Please help me figure this out, this was working just fine a bit ago, But after i had to make a few changes, it completely broke (those changes being checking if the part is active instead of checking if the part is not nil)
Module script (mock-up, Not real deal.)
function silly_module:clear()
if self.SillyPart ~= nil then
self.SillyPart:Destroy()
self.SillyPart = nil
if self.SillyPart == nil then
print("Silly is nil")
else
print("woah woah whys this happening?")
end
end
end
function silly_module:Use()
reallysillybindableevent.Fire(function()
task.wait(silly_time_number)
if realcheckstuff = "cool" then
self.SillyActive = true
task.wait(even_sillier_time_number)
self:clear()
print("its REALLY silly now")
end
end)
end
I geniunely have no idea why it all of a sudden doesnt work. “Silly is nil” prints, “Its REALLY silly now” (also when i fire without the part being there) prints, They all print just fine, But it isnt true, the part is NOT destroyed (when its fired with the part still there. and yes the part is set to the SillyPart variable, in fact, its created like that, Plus i never messed with that part, so it shouldnt be that)
Any help is appreciated, If you have any questions, Please ask me!