My game was working perfectly until most of the scripts suddenly stopped working properly.
The scripts in my game would suddenly break in the middle of it, so while analysing the possible reasons I noticed that when I used wait() in a script it simply breaks after it.
Then, I replaced all the wait() with task.wait() and the code started working again, however, there were module scripts that crashed the game when I used task.wait(), so basically these scripts are no longer working as the wait() simply breaks the code.
I’ve tried disabling all of my plugins and it didn’t change anything. Seems like this glitch is only happening to me. I really need help as I need to continue developing it.
I wanted to post this is the bug report category however I’m not allowed to.
I’ll show you an example of how the game was working before and then how it is after the wait() simply started breaking most of my scripts.
AFTER (I don’t have any video of how it was working before but basically the text you are seeing on the screen had a typewriting effect with a for loop, but since the wait() breaks most of my scripts and I can’t use task.wait() inside my module without crashing I can’t fix this)
THIS IS THE MODULE SCRIPT WHERE I COULDN’T FIX BY REPLACING WAIT() WITH TASK.WAIT() AS IT CRASHED THE GAME
local TypeWriteService = {}
TypeWriteService.Type = function(object, text, length)
for i = 1, #text, 1 do -- the last 1 refers to the amount of characters per time
object.Text = string.sub(text, 1, i)
wait(0.1) -- The typewriting stops after this as the wait breaks the code
end
end
return TypeWriteService
By the way, I could only fix the other scripts because I could change wait() for task.wait(), even though I want to know why the wait() is making them break.
Also, yesterday I made tests where I coded:
print("Fired")
wait(5)
print("FiredAgain")
And the second part didn’t get printed. Yeah you probably understand that the wait is breaking it.