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

ParticleEmitter won't clone onLevelUp?

Asked by 6 years ago

I have created a script for my friend's game. The script is supposed to clone particles when a player levels up, the particles are very specific and are within the script. I have tested this in Roblox Studio "Play" mode and in a live server, the Particles don't clone themselves and Sound:Play() only works after removing the coding up to

script.Parent.Parent.Parent.Parent.Character.Torso.ParticleEmitter.Parent = nil. 

The script is located in ServerScriptService as a regular script. I've narrowed it down to this snippet of coding, after running print() on each line:

on = false

function onLevelUp(player, XP, level) 
    if player.Character~=nil then 
        for i = 1,5 do 
        script.Parent.Parent.Parent.Parent.Character.Torso.ParticleEmitter.Parent = nil
        on = false
        local e = script.ParticleEmitter:Clone()
        e.Parent = script.Parent.Parent.Parent.Parent.Character.Torso
        script.Sound:Play() 
        wait(3)
        on = true
        end
    end

Thanks for reading/replying.

0
Is filtering disabled? ArcticDev 9 — 6y
0
No filtering is enabled STICKYBUN10 19 — 6y
0
try running an IF statement to check if a particle emitter already exists at the beginning of your function. It would error if the particle didn't exist yet, unless you already have one there. Nothing in your code shows that one does tho Legoman654 100 — 6y

Answer this question