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

local clickDetector = script.Parent.ClickDetector
local particle1 = script.Parent.Particle1.ParticleEmitter 
local particle2 = script.Parent.Particle2.ParticleEmitter
local particle3 = script.Parent.Particle3.ParticleEmitter

while true do
	print("can break")
	wait(43)
	local Break = math.random(1,10)
	if Break == 3 then
		particle1.Enabled = true
		particle2.Enabled = true
		particle3.Enabled = true
		print("break")
end
end

function Particlefix()
	particle1.Enabled = false
	particle2.Enabled = false
	particle3.Enabled = false
	print("fix")
end
 
clickDetector.MouseClick:connect(Particlefix)
print("it all loads")

6 comments

0

Are you waiting 43 seconds first?

0

Only puts can break, the fix also doesn't seem to work and it doesn't print "it all loads" as well.

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?

0

The breaking did take a century to work (bad RNG) but it eventually did, the fix doesn't work still.

0

Maybe enclose the while true do loop in a separate thread/coroutine/spawn?

0

What do you mean by that? I don't know how to enclose it in a separate thread/coroutine/spawn