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

Why isn't the particle emitter being destroyed?

Asked by 3 years ago

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

0
I tested your script and it is destroying the particle emitter? Feelings_La 399 — 3y
0
That's really strange I don't know why it isn't working for me DesiredRep 75 — 3y

3 answers

Log in to vote
1
Answered by 3 years ago

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?

0
Tested it and realized it sometimes won't destroy the particle because of this line Feelings_La 399 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

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!

0
Already attempted to do this, all it did was skip the destroy line and print. DesiredRep 75 — 3y
0
sorry, i cant understand can u make it a bit more detailed? Rgboffical_yt 40 — 3y
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. DesiredRep 75 — 3y
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? Rgboffical_yt 40 — 3y
0
hello just to keep myself updated, did it posiblly work?(im guessing not) Rgboffical_yt 40 — 3y
Log in to vote
0
Answered by 3 years ago

Try putting

wrong.Enabled = true

Answer this question