Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Script skipping the task "Auto disabling" Why?

Asked by 5 years ago

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.

0
Your script seems alright. It should disable at the end of the loop. 0_Halloween 166 — 5y
0
But for some reason it don't, it just skip it and keep change his position dingding2002 14 — 5y
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. kizi3000 88 — 5y
0
you're disabling the script u nerd. it obviously isnt going to run after the very first time this loop runs Gey4Jesus69 2705 — 5y
View all comments (7 more)
0
lol SummerEquinox 643 — 5y
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 dingding2002 14 — 5y
0
disabling the script won't break the loop. SummerEquinox 643 — 5y
1
Just use [break](https://developer.roblox.com/articles/Roblox-Coding-Basics-Loops#Break) -- also, if you only want this to happen once; why are you using a loop? SummerEquinox 643 — 5y
0
@SummerEquinox well even if i'm not using a loop, it keep to repeat it dingding2002 14 — 5y
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. SummerEquinox 643 — 5y
0
No, it's not so different, I just ignored the part that it copies a part dingding2002 14 — 5y

Answer this question