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

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

Asked by 4 years ago

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.

0
I recommend starting with basics and not making a full on game. Fl3eandFlo3e 18 — 4y
0
Ok, ill work on the basics. ihateursun 2 — 4y
0
Done! LioshaPlay 66 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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.

Ad

Answer this question