Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer
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.

7 comments

0

Works as before, still as you die, particle emitter turns off

0

OK i will try to make anything better

0

is it a local script or normal script?

0

It is local script and (if it matters) it's inside text button

0

Ok in your ScreenGui just make ResetOnSpawn Disabled and this script will work.

0

Oh... Sorry I thought I disabled it before... Thanks for your help

0

Thanks for accepting as answer :)

This discussion is preserved as it was. New answers, comments, and votes are closed.