I'm trying to make a new ROBLOX GOT TALENT game but when I enter the game, the emitter is still going I wanna know how to turn it off and turn back on when you press a button.
Hi, I'm Zgoly (on YouTube), first make a brick,
create a ClickDetector
and ParticleEmitter
in the brick, create a script
in ParticleEmitter
, then paste this into the script:
local isOn = true function on() isOn = true script.Parent.Enabled = false end function off() isOn = false script.Parent.Enabled = true end function onClicked() if isOn == true then off() else on() end end script.Parent.Parent.ClickDetector.MouseClick:connect(onClicked) on()
If you want this to work remotely, first create a brick and create the following objects in it: a brick that will be like a button (change the brick name to Button) and ParticleEmitter. Create a script in ParticleEmitter, create a ClickDetector in Button. Then in the script above, paste this:
local isOn = true function on() isOn = true script.Parent.Enabled = false end function off() isOn = false script.Parent.Enabled = true end function onClicked() if isOn == true then off() else on() end end script.Parent.Parent.Button.ClickDetector.MouseClick:connect(onClicked) on()
Done! Now when you click on a Button, it will turn on / off ParticleEmitter
, and at the same time, initially, ParticleEmitter
will be turned off. Goodbye, I wish you to create a cool game.