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

I was messing around with scripts and was wondering if this would work?

The script is supposed to do something like in the impossible obby for when you touch the checkpoint particles shoot up, yes I know it won’t be in the correct position I just want it to create a particle emitter and delete it a little bit later.

The script:

part = game.Workspace

function particle() local myPE instance.new(“ParticleEmitter”) end

game.workspace.part.touched:Connect(particle)

wait(3)

myPE:Destroy end)

1 answer

local part = workspace:WaitForChild("part") -- name of the part inside of the workspace in the explorer

function particle() 
  local myPE = Instance.new(“ParticleEmitter”)
  myPE.Parent = workspace -- where the particles show up on the explorer, here they will be 
  showing on the workspace
  wait(3) -- wait 3 seconds before continuing the function
  myPE:Destroy() -- remove from the workspace
end

part.Touched:Connect(particle) -- run the function upon touch of the part

local variables inside functions cant be used outside of them, unless they are global by not adding local.

because of this, myPE can only be used inside the lines of the particle() function.

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