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

Loops/functions aren't starting in my script and it won't even make it to then end, any fixes?

Asked by
lukedm 0
4 years ago

I have a script which is supposed to turn on and off particles depending on if it's clicked or with a random number generator, I only got the "can break" print to show, can someone help me? An image of the explorer is in the gyazo link. https://gyazo.com/3039b5bdd28980d0555e4d82af89f426

01local clickDetector = script.Parent.ClickDetector
02local particle1 = script.Parent.Particle1.ParticleEmitter
03local particle2 = script.Parent.Particle2.ParticleEmitter
04local particle3 = script.Parent.Particle3.ParticleEmitter
05 
06while true do
07    print("can break")
08    wait(43)
09    local Break = math.random(1,10)
10    if Break == 3 then
11        particle1.Enabled = true
12        particle2.Enabled = true
13        particle3.Enabled = true
14        print("break")
15end
View all 26 lines...
0
Are you waiting 43 seconds first? TornadoCookie 20 — 4y
0
Only puts can break, the fix also doesn't seem to work and it doesn't print "it all loads" as well. lukedm 0 — 4y
0
You're using math.random. You may have to do a couple of tries for it to show its working, unless I'm wrong? nekosiwifi 398 — 4y
0
The breaking did take a century to work (bad RNG) but it eventually did, the fix doesn't work still. lukedm 0 — 4y
View all comments (2 more)
0
Maybe enclose the while true do loop in a separate thread/coroutine/spawn? radiant_Light203 1166 — 4y
0
What do you mean by that? I don't know how to enclose it in a separate thread/coroutine/spawn lukedm 0 — 4y

Answer this question