Touch A Brick To Make Particles Appear

Similar to what I’m trying to do:


Ignore the gui when I touch it

Trying to make it fade when it appears then fade when it goes away.

Try:

local Particles = Instance.new("ParticleEmitter")--Type the true name of the instance if i typed it wrong.

Particles.Parent = script.Parent
--The other properties you can change it by your own.
--Particles.Propertie = true
--Particles.Propertie2 = 1
--Particles.Propertie3 = "text"
--(Those are examples)

I’am not very sure if this code is going to work.

Didn’t work with a touch event. And I’m pretty sure I need to use some kind of NumberSequence.

Consider checking this ParticleEmitter | Documentation - Roblox Creator Hub

ParticleEmitter.Enabled = true

or

ParticleEmiiter.Enabled = false

If you had readed it well,you should have know this,you can see all the functions of an instance while scrolling down the page.

I already checked that out, but I don’t know how to manipulate it to make it so the particle fades in and fades out when you touch it.

script.Parent.Touched:connect(function(Touched)
    local Particles = Instance.new("ParticleEmitter",script.Parent)
    Particles.Enabled = true
    wait(1)--Insert delay between it activated and deactivated here.
    Particles.Enabled = false
end)

Sorry,i dont know how to make it stop doing the particles many times.

It’s fine, I’ll try to figure it out.

1 Like

Toggling Particles

The code from the earlier post works just fine, but what it’s missing is debounce. We use debounce to prevent the spam. So basically the code below would allow you to touch the brick every 3 seconds; You can of course change that to any other amount by simply replacing number 3 in delay function delay(3, function() with any other number. Delay will wait n amount of seconds without making the code yield.

SpawnLocation.Touched:Connect(function(Hit)
    if Debounce then return end
    local Humanoid = Hit.Parent:FindFirstChild("Humanoid")
    if Humanoid then
        local Player = Players:GetPlayerFromCharacter(Hit.Parent)
        if Player then
            ParticleEmitter.Enabled = true
            Debounce = true
            delay(3, function() 
                ParticleEmitter.Enabled = false 
                Debounce = false 
            end)
        end
    end
end)

Fading Particles

If I understand you correctly, in order to make it fade out, you’d have to play around with its Transparency property which is a NumberSequence
Screenshot_1
First you go to ParticleEmitter’s properties and select transparency, then simply click the three dots as it’s shown on the image above.


This window should then appear, the graph above would linearly make particles fade out.

7 Likes
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
--//--
workspace.Brick.Touched:Connect(function(hit)
   game.Workspace.Brick.ParticleEmmiter.Enabled = true
   wait(1)
   game.Workspace.Brick.ParticleEmmiter.Enabled = false
end)

I might be wrong but I hope It can help you.

1 Like

You pretty much did the same as @PhoenixRessusection
I want it to fade in when you touch it and fade out after a certain amount of time

I didnt add an debounce,because i though you wanted to do it one time only,but if you want an delay,do the code that rokec used.

Why did you make 2 variables,if you didnt use them?Also,the game can detect that who touched the brick can be an brick/not the player.

Did you read my post, I’ve included everything you asked for.

1 Like

It works! Thank you for helping me. I honestly don’t know why I skipped your post.