Ok so, I want the script to disable itself but for some reason it just skip the task and i have no idea why.

Here an example :

while true do
model.Position = Spawner.Position + Vector3.new(math.random(-Spawner.Size.x/2, Spawner.Size.x/2), math.random(0,10), math.random(-Spawner.Size.z/2,Spawner.Size.z/2))
script.Disabled = true
end 

Can someone explain why? Also, please understand that this is just an example.

11 comments

0

Your script seems alright. It should disable at the end of the loop.

0

But for some reason it don't, it just skip it and keep change his position

0

@dingding2002 try using print("test") inside of the script and see if it works, if it doesn't then that means your entire while true do loop doesn't do anything, also you might want to add a wait() in there because if you have a while true do loop without any waits and it is active then your computer might not be able to handle it.

0

you're disabling the script u nerd. it obviously isnt going to run after the very first time this loop runs

0

lol

0

i used a print at the end of the while true do and it work, and if i'm going to check if the script is disabled well it is but for some reason the script keep running so the print always come back

0

disabling the script won't break the loop.

1

Just use break -- also, if you only want this to happen once; why are you using a loop?

0

@SummerEquinox well even if i'm not using a loop, it keep to repeat it

0

Then the code you have provided and the code you are referring to are completely different. Because breaking this loop / not using a loop will make this happen only one time.

0

No, it's not so different, I just ignored the part that it copies a part