I’m trying to make a simple script that changes a billboardgui’s imagelabel constantly. When i made the script, i first used wait(), and it worked perfectly fine, now that i see the new feature of task.wait(), i replaced the waits with it, and i keep getting this error in either lines 5, 7 or 9 randomly: attempt to index nil with 'ImageLabel'
. The script is inside the billboardgui.
while true do
wait(0.3)
if script.Parent.ImageLabel ~= nil then
if script.Parent.ImageLabel.Image ~= nil then
script.Parent.ImageLabel.Image = game.ServerStorage.Extra.DeleteDecal["1"].Texture
task.wait(0.3)
script.Parent.ImageLabel.Image = game.ServerStorage.Extra.DeleteDecal["2"].Texture
task.wait(0.3)
script.Parent.ImageLabel.Image = game.ServerStorage.Extra.DeleteDecal["3"].Texture
end
end
end
The 2 if checks weren’t originally there, i added them to check if that fixed the problem, but no, they didn’t.
The billboardgui is inside a folder in serverstorage, and the script is disabled, i have another script as well that clones it and enables the script. After some seconds, the error appears, but somehow, the image keeps changing normally.
Can someone help me? This feature is new and i don’t really know what to do.