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

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

Asked by
QNCL0 5
3 years ago
Edited 3 years ago

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

Log in to vote
0
Answered by 3 years ago
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.

Ad

Answer this question