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

Why isn't the particle emitter being destroyed?

This script works with fire and smoke, but not with this? Why? How do I fix it? Thanks for the help

local event = game.ReplicatedStorage.Remotes.deny
local players = game:GetService("Players")
local replicated = game.ReplicatedStorage
local function deny(player)
	local wrong = Instance.new("ParticleEmitter")
	wrong.Texture = ("rbxassetid://5973806628")
	wrong.Rate = 1
	local no = Instance.new("Sound")
	local yes = Instance.new("Sound")
	no.SoundId = ("rbxassetid://2781528288")
	yes.SoundId = ("rbxassetid://151573243")
	yes.Parent = wrong
	no.Parent = wrong
	wrong.Parent = player.Character.Head
	local a = 1
	local b = 2
	local number = 	math.random(1,2)
	if number == 1 then
		no:Play()
		else yes:Play()
	print("Fired Deny")
	wait(1.5)
		wrong:Destroy()
			end
		end

event.OnServerEvent:Connect(deny)
	

Also if you have recommendations on how to make this code better let me know

2 comments

0

I tested your script and it is destroying the particle emitter?

0

That's really strange I don't know why it isn't working for me

3 answers

✓ Accepted answer

Well, I think the problem is in line 18

if number == 1 then
	no:Play()
else yes:Play()
	print("Fired Deny")
	wait(1.5)
	wrong:Destroy()
end

You forgot to put wrong:Destroy() inside first if statement, I think?

1 comment

0

Tested it and realized it sometimes won't destroy the particle because of this line

Try using prints and see what line its broken into ex:

script.Parent:Destroy()
print("it was the destroy part")

and try fixing the line that u figured out the error in!

5 comments

0

Already attempted to do this, all it did was skip the destroy line and print.

0

sorry, i cant understand can u make it a bit more detailed?

0

It would just overlook the destroy line and print. Nothing in the script is broken, it just won't destroy the particle emitter for whatever reason. It works perfectly fine with the other effects though.

0

hmmmmmmm..lets test something make another script copy and paste this script to the new script and then in the newScript try removing the math.random function and see if it works?

0

hello just to keep myself updated, did it posiblly work?(im guessing not)

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