Hey, I have a system that in certain time in the game a HighlightTemplate gets cloned onto a player so they glow and after 5 seconds it should get destroyed… that works! But for some reason it always prints error in the console after the deletion of the highlight.
My script (which is a child of the HighlightTemplate):
local checkInterval = 1 local function checkLocation() local parent = script.Parent and script.Parent.Parent if parent and parent:IsA("ReplicatedStorage") then else wait(5) script.Parent:Remove() end end while true do checkLocation() wait(checkInterval) end
The error: attempt to index nil with ‘Remove’
I already tried to do everything I could to fix it, but still for some reason the script.Parent is nil and it cannot be removed with Remove() or even with Destroy()