I have some parts with trails on them moving towards the player on the RenderStepped event. I am 'destroying' them when they get close instead of using collision because they are cosmetic only, however something weird is happening with my destroy function. In my 'update' function I do:
if(dist < 1) then
self:destroy(false)
end
which causes them to behave weird. If I remove this or replace it with self:Destroy() it works how it should (when they get close, they are destroyed). The only reason I'm making my own destroy function is because I want to wait for the trail to expire.
Here is my 'destroy' function:
function ItemStar:destroy(destroyImmediate)
if not self.part then
return
end
if not destroyImmediate then
self.linearVel.VectorVelocity = Vector3.zero
self.linearVel:Destroy()
self.part.Anchored = true
self.part.Transparency = 0 -- change to 1 after debugging
wait(2.1)
end
self.part:Destroy()
end
if I remove the entire "if not destroyImmediate" if statement, this also works.
I've attached a video of what is happening, I think it explains what is happening better than I can with words.
does doing self.linearVel:Destroy() not destroy the linear velocity part? I am updating that in my 'update' function, but I never get any errors in the console.
** You are now Level 1! **