onTouch Particle Event

Hi again! So I am kind of new to scripting but have been a builder for a while. I am trying to make an onTouch event so when the player steps on the part, particles come out of the part and then they stop a second later. I was hoping someone on the DevForum could help me out!

Thank You!!

1 Like

something like this:

local GetBlocks = --part that player must stand on

local function steppedOn(part)
	local parent = part.Parent
	local Player = game.Players:GetPlayerFromCharacter(parent)
	
	if Player then
	--put stuff when player goes on brick here
	end
end

GetBlocks.Touched:Connect(steppedOn)

this goes inside a script

1 Like

What do you mean by part that player must stand on and put stuff when player goes in brick here?

He means the part that the player steps on so like if the script is in the part they touch then it would be

local GetBlocks = script.Parent

And the part where it says put stuff, you put what the brick will do if they touch it. Basically enable the particles like you said.

The particle emitter has a function called emit() that can be called on it when the particle emitter is disabled. Perhaps this would work:

local Brick -- Set this variable to the part you want the player to stand on.
local Emitter -- Set this to the particle emitter.

Brick.Touched:Connect(function(Part)
    if not part.Parent:FindFirstChild("Humanoid") then -- This is to make sure whatever touched it is a character.
        Emitter:emit(50) -- Set the number in the parenthesis to the number of particles you want it to emit.
    end
end)

Hopefully this works for you :smiley:

1 Like