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

How to make this particle emitter doesn't disappear on death?

Asked by 6 years ago

Every time a character dies, the particle emitter is being removed, what should I do to keep the particle emitter in the character until it's unequiped by a player?

on = false

Player = game.Players.LocalPlayer
Cost = 1
Coins = Player.leaderstats.Coins

script.Parent.MouseButton1Click:connect(function()
    if on == true then 
    script.Parent.Parent.Parent.Parent.Parent.Character.Torso.ParticleEmitter.Parent = nil
    on = false
    script.Parent.Text = "Disabled"
    elseif on == false and Coins.Value >= Cost then
    local e = script.ParticleEmitter:Clone()
    e.Parent = script.Parent.Parent.Parent.Parent.Parent.Character.Torso
    script.Parent.Text = "Enabled"
    on = true
    end
end)

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago
on = false

Player = game.Players.LocalPlayer
Cost = 1
Coins = Player.leaderstats.Coins

script.Parent.MouseButton1Click:connect(function()
    if on == true then 
    Player.Character.Torso.ParticleEmitter:Destroy()
    on = false
    script.Parent.Text = "Disabled"
    elseif on == false and Coins.Value >= Cost then
    local e = script.ParticleEmitter:Clone()
    e.Parent = Player.Character.Torso
    script.Parent.Text = "Enabled"
    on = true
    end
end)

Player.CharacterAdded:Connect(function (char)
    if on == true then 
        local e = script.ParticleEmitter:Clone()
        e.Parent = char.Torso
    end
end)

Just added some lines into script, I hadn't tested but it should work.

0
Works as before, still as you die, particle emitter turns off Pikol53 0 — 6y
0
OK i will try to make anything better TheSkyofIndia 150 — 6y
0
is it a local script or normal script? TheSkyofIndia 150 — 6y
0
It is local script and (if it matters) it's inside text button Pikol53 0 — 6y
View all comments (3 more)
0
Ok in your ScreenGui just make ResetOnSpawn Disabled and this script will work. TheSkyofIndia 150 — 6y
0
Oh... Sorry I thought I disabled it before... Thanks for your help Pikol53 0 — 6y
0
Thanks for accepting as answer :) TheSkyofIndia 150 — 6y
Ad

Answer this question