Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do you turn off a emitter when you enter a game?

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.

3 comments

0

I recommend starting with basics and not making a full on game.

0

Ok, ill work on the basics.

0

Done!

1 answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.