I'm making a button that will enable and disable a Particle Emitter after five seconds but nothing happens once I click the button.
function onClick() game.Workspace.Part.ParticleEmitter.Enabled = true wait(5) game.Workspace.Part.ParticleEmitter.Enabled = false end script.Parent.ClickDetector:connect(onClick)
A possibility of it not working could be simply because of a silly mistake. The silly mistake in this case would be that, because there is multiple parts in the Workspace named "Part" itll go with the first one the script finds, and attempt to find Particle Emitter, and if it doesnt than it just errors.
The best way to fix this is to rename the part, or put the script inside of the part and use script.Parent.
Hope I helped, csmz!
I edited your code and made it work. Instead of grabbing the part from workspace just use script.Parent
function onClick() script.Parent.ParticleEmitter.Enabled = true wait(5) script.Parent.ParticleEmitter.Enabled = false end script.Parent.ClickDetector:connect(onClick)