#Why won't my VFX emit?

1 messages · Page 1 of 1 (latest)

tropic anvil
#

For some reason, my particle emit function only worked when I took the VFX from replicated storage into the vfx folder. But now it doesn't work when I clone it.

glad nebula
#
local debris = game:GetService("Debris")
local event = rs:WaitForChild("SlashVFX")

event.OnServerEvent:Connect(function(plr)
    local char = plr.Character
    local hum = char and char:FindFirstChild("Humanoid")
    local hrp = char and char:FindFirstChild("HumanoidRootPart")
    
    if not hum or not hrp then return end

    -- freeze the player
    hum.WalkSpeed = 0
    
    -- spawn the vfx
    local slash = rs.VFX.Sword:Clone()
    slash.CFrame = hrp.CFrame
    slash.Parent = workspace.Fx
    
    -- fast emit loop
    for _, v in slash:GetDescendants() do
        if v:IsA("ParticleEmitter") then
            v:Emit(v:GetAttribute("EmitCount") or 25) -- take a look, you can change the 25 if the code doesnt find an attribute, feel free to change
        end
    end
    
    -- clean up and unfreeze
    debris:AddItem(slash, 1.7)
    
    task.delay(1.1, function()
        if hum.Parent then
            hum.WalkSpeed = 16
        end
    end)
end)```
#

try this'

#

i made comments so its easier for u to find errors

#

errors doesnt seem the right way to type it but it is lol

tropic anvil
#

i see

hoary robinBOT
#

studio** You are now Level 2! **studio

tropic anvil
#

ill try this

#

the particles still dont emit

glad nebula
#

Where is the script located

tropic anvil
#

SSS

#

the part shows up

#

i stop moving

#

no errors

#

just no vfx

glad nebula
#

Sss doesnt see local scripts

#

Thats the problem prolly

tropic anvil
#

it can if i fire it

#

thats why i have the on server event

#

and the script itself isnt a local script

glad nebula
#

Ima try to code it rq

tropic anvil
#

ok so

#

i got it to work

#

but i have to put a wait before i emit it?

glad nebula
#

if ya want to delay it

#

also the script i provided is supposed to be a mormal script

#

normal

tropic anvil
#

yea it i

#

is

#

it emits now

glad nebula
#

gj

tropic anvil
#

but only after I put a wait before

#

the emit loop

glad nebula
#

didnt expect that to be thee problem lol

tropic anvil
#

idk why that is

#

i mean there isnt a delay

#

its just weird

glad nebula
#

lemme try to fix it without a wait

#
local debris = game:GetService("Debris")

local vfxFolder = rs:WaitForChild("VFX")
local swordModel = vfxFolder:WaitForChild("Sword")
local event = rs:WaitForChild("SlashVFX")

event.OnServerEvent:Connect(function(plr)
    local char = plr.Character
    local hum = char and char:FindFirstChild("Humanoid")
    local hrp = char and char:FindFirstChild("HumanoidRootPart")
    
    if not hum or not hrp then return end

    hum.WalkSpeed = 0
    
    local slash = swordModel:Clone()
    slash.CFrame = hrp.CFrame
    slash.Parent = workspace:WaitForChild("Fx")
    
    for _, v in slash:GetDescendants() do
        if v:IsA("ParticleEmitter") then
            v:Emit(v:GetAttribute("EmitCount") or 25)
        end
    end
    
    debris:AddItem(slash, 2)
    
    task.delay(0.7, function()
        if hum and hum.Parent then
            hum.WalkSpeed = 16
        end
    end)
end)``` just needed wait for child
tropic anvil
#

wow

glad nebula
#

the problem with the wait is that if the player has a bad pc it can be not enough of time for a slow pc, for a fast pc it just wastes time

hoary robinBOT
#

studio** You are now Level 7! **studio

glad nebula
#

its not optima

#

optimal

tropic anvil
#

ah

#

well

#

i see where you put the wait for child

#

but thats a folder

#

so

#

i dotn know where to put it

glad nebula
#

ohh

#

put the script i sent u in sss

tropic anvil
#

which one

glad nebula
#

the latest one

#

but if u want u can use the wait command but put it below 0.001 seconds

#

its not optimal if its 1 second +

tropic anvil
#

ok