How To Make Particles Local?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Make a setting that enables and disables particles locally.
  2. What is the issue? Include screenshots / videos if possible!
    The particles don’t appear in game.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Searching the dev forum, but there weren’t really any posts about it.
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

``local Generator = script.Parent
while task.wait() do
if game.Players.LocalPlayer:WaitForChild(“PlayerData”):WaitForChild(“Settings”):WaitForChild(“Particles”).Value == true then
if Generator.Level.Value == 11 then
Generator.Ascended.Enabled = true
end
if Generator.Level.Value == 12 then
Generator.Unfathomable.Enabled = true
end
if Generator.Level.Value == 13 then
Generator.Galaxy.Enabled = true
end
if Generator.Level.Value == 14 then
Generator.Transcended.Enabled = true
end
if Generator.Level.Value == 15 then
Generator.Limitless.Enabled = true
end
if Generator.Level.Value == 16 then
Generator.Omega.Enabled = true
end
if Generator.Level.Value == 17 then
Generator.Beyond.Enabled = true
end
if Generator.Level.Value == 18 then
Generator.Life.Enabled = true
end
if Generator.Level.Value == 19 then
Generator.null.Enabled = true
end
if Generator.Level.Value == 20 then
Generator.Void.Enabled = true
end
if Generator.Level.Value == 21 then
Generator.Glitch.Enabled = true
end
if Generator.Level.Value == 22 then
Generator.Pie.Enabled = true
end
if Generator.Level.Value == 23 then
Generator.Zenith.Enabled = true
end
if Generator.Level.Value == 24 then
Generator.OrangeJuice.Enabled = true
end
if Generator.Level.Value == 25 then
Generator.Chilly.Enabled = true
end
if Generator.Level.Value == 26 then
Generator.noob.Enabled = true
end
if Generator.Level.Value == 27 then
Generator.Burger.Enabled = true
end
if Generator.Level.Value == 28 then
Generator.Radioactive.Enabled = true
end
if Generator.Level.Value == 29 then
Generator.Dank.Enabled = true
end
if Generator.Level.Value == 30 then
Generator.Water.Enabled = true
end
if Generator.Level.Value == 31 then
Generator.Sigma.Enabled = true
end
if Generator.Level.Value == 32 then
Generator.SCP.Enabled = true
end
if Generator.Level.Value == 33 then
Generator.Apple.Enabled = true
end
if Generator.Level.Value == 34 then
Generator.Ferbert.Enabled = true
end
if Generator.Level.Value == 35 then
Generator.Ghost.Enabled = true
end
if Generator.Level.Value == 36 then
Generator.Phoenix.Enabled = true
end
if Generator.Level.Value == 37 then
Generator.Doge.Enabled = true
end
if Generator.Level.Value == 38 then
Generator.Shocking.Enabled = true
end
if Generator.Level.Value == 39 then
Generator.Tide.Enabled = true
end
if Generator.Level.Value == 40 then
Generator.Bomb.Enabled = true
end
if Generator.Level.Value == 41 then
Generator.Ice.Enabled = true
end
if Generator.Level.Value == 42 then
Generator.Otherworldly.Enabled = true
end
if Generator.Level.Value == 43 then
Generator.Underworld.Enabled = true
end
if Generator.Level.Value == 44 then
Generator.Terminated.Enabled = true
end
if Generator.Level.Value == 45 then
Generator.Cryptic.Enabled = true
end
if Generator.Level.Value == 46 then
Generator.Hero.Enabled = true
end
if Generator.Level.Value == 47 then
Generator.Magic.Enabled = true
end
if Generator.Level.Value == 48 then
Generator.Infinity.Enabled = true
end
if Generator.Level.Value == 49 then
Generator.Sandwich.Enabled = true
end
if Generator.Level.Value == 50 then
Generator.Cat.Enabled = true
end
if Generator.Level.Value == 51 then
Generator.Cupcake.Enabled = true
end
if Generator.Level.Value == 52 then
Generator.Polyhed.Enabled = true
end
if Generator.Level.Value == 53 then
Generator.Yessir.Enabled = true
end
if Generator.Level.Value == 54 then
Generator.Balluh.Enabled = true
end
else
for _, descendant in pairs(Generator:GetDescendants()) do
if descendant:IsA(“ParticleEmitter”) then
descendant.Enabled = false
end
end
end
end


Please do not ask people to write entire scripts or design entire systems for you. If you can't answer the three questions above, you should probably pick a different category.
1 Like

dafoe
oh gosh

um, you should just be able to change them on the clients. The only real caveat there is that any updates that the server makes will take priority, and then reset the corresponding properties on the clients. This behavior can be avoided by making the ParticleEmitters only exist on the client (using Instance.new() or :Clone() on the client)

other than that, you’re just debugging: use print() functions to see whats running in your code and whats not

6 Likes

Forgot to mention this is a local script

I believe you can do this by just setting the particles to enabled on the client only.

I think the problem with your code is that you disable all of the particle emitters at the end of the loop, overwriting when your code turns them on:

You should instead move that code to disable all of the particle emitters to before turning on the right particle emitter, so that it:

  • Turns off all the particle emitters
  • Turns on the right emitter
  • Wait (with the emitter on)

Instead of:

  • Turn on the right particle emitter only to turn them all off
  • Wait (with the emitter off)

(Edit: I didn’t notice one of the extra else statements that prevents this)


I would also highly recommend moving your mapping to a table instead of having it in a bunch of if statements. For example, something like this:

-- Define this somewhere at the top of your code
local levelEmitterNameMap = {
    [11] = "Ascended",
    [12] = "Unfathomable",
    [13] = "Galaxy",
    -- TODO: Continue this
}


-- To replace the big line of if statements:

local level = Generator.Level.Value
-- If the level is in the table
if table.find(level) then
    -- Turn on the corresponding emitter
    local emitterName = levelEmitterNameMap[level]
    Generator[emitterName].Enabled = true
end
2 Likes

is this satire

1 Like

Thanks but I figured it out, I had to change the local script to a regular one and change the run context.

1 Like

Oh yeah. LocalScripts only run in certain places, but Scripts set to client context work most places.

Also, for the other thing, I didn’t notice your code had an else statement to switch between turning them on and turning them all off.

image

reminds me of yanderedev LOL

good luck with your rng game buddy glad you got people to help

2 Likes