#why does my script go on an infinite loop even though i have task.wai(1)?
1 messages · Page 1 of 1 (latest)
bro a while true do loop runs forever
task.wait adds 1 second to each interval before a new one happens
so even if you do a .Touched connection it makes a new connection
and the while loop jus goes on and on
bro you literally have "while true do"
its gonna keep printing every 1 second
** You are now Level 3! **
ik what a while true do is, it means it runs every time its true and it always is true, but why doesnt it run the task.wait(1) too? why doesnt every loop wait 1 second and then print hello
dude everytime you touch it
it makes a new connection
which causes multiple loops to happen
timmy understand that the task.wait(1) does run. Rascal berry said that multiple loops will happen which is correct since many Touched events will fire. so if you only want 1 touch then you have to check for the player and exit if he already touched once or not