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

Making particles appear when touching a spawnpoint doesn't work, anyone able to help ?

Asked by 5 years ago

I made a script to make a particle's clone to weld to the player and move it a bit, then I made another script to make it appear and disappear when I touch a spawnpoint but it doesn't work. Here's the script :

local Checkpoint = script.Parent local Player = game.Workspace.LocalPlayer local Part = Player:WaitForChild("LevelUpParticles") local Particles = Part:WaitForChild("ParticleEmmiter") Checkpoint.Touched:Connect(function() for i = 0,5 do Particles.Rate = Particles.Rate +1 wait(.1) end end)
wait(1) for i = 0,5 do Particles.Rate = Particles.Rate -1 wait(.1) end

It's a local script that I placed directly in the spawnpoint ( I also don't get any errors in the output)

0
Use a debounce. DeceptiveCaster 3761 — 5y

1 answer

Log in to vote
0
Answered by
Y_VRN 246 Moderation Voter
5 years ago

Here I added a debounce and organized your script a bit.

local Checkpoint = script.Parent
local Player = game.Workspace.LocalPlayer
local Part = Player:WaitForChild("LevelUpParticles")
local Particles = Part:WaitForChild("ParticleEmmiter")
local Debounce = false

Checkpoint.Touched:Connect(function()
    if Debounce == false then
        Debounce = true
        for i = 0,5 do
            Particles.Rate = Particles.Rate +1
            wait(.1)
        end
        wait(1)
        for i = 0,5 do
            Particles.Rate = Particles.Rate -1
            wait(.1)
        end
        Debounce = false
    end
end)

Use the "Tab" key to organize your code. I had a bit of a hard time understanding it.

Ad

Answer this question