:Emit() is not working properly

Hey. I’m fairly new to VFX things and particles. I’m trying to weld a bunch of particles to npc’s humanoid root part and trying to emit them. If i make particle.Enabled = true then it’s working perfectly but particle:Emit(10) is not doing anything. I tried to emit them manually after welding with a plugin and it’s working too idk what is the problem. Here is my code :

--This code block works on module script
local enemyHumRp = enemyHum.Parent:FindFirstChild("HumanoidRootPart")

local impactObj = ReplicatedStorage.Abilities.impact:Clone()
impactObj.Parent = enemyHumRp

impactObj.CFrame = enemyHumRp.CFrame * CFrame.new(Vector3.new(0,0,-0.6)) * CFrame.Angles(math.rad(-90), 0, 0)

local weld = Instance.new("WeldConstraint")
weld.Parent = enemyHumRp
weld.Part0 = impactObj
weld.Part1 = enemyHumRp

for i, obj in ipairs(impactObj.Attachment:GetChildren()) do
	if obj:IsA("ParticleEmitter") then
		warn(obj.Name) --it's printing the particle emitters they are correct
		obj:Emit(50)
		--obj.Enabled = true  --if i use this i can see the particles
	end
end

From the looks of it, that loop runs once and never again, and the particles likely emit while your roblox studio is loading the game up. I’d make a trigger for it or something, like a ClickDetector or ProximityPrompt.

It’s just part of my function. This code is not running immediately. I’m calling it with a keypress and i’m watching it carefully.

When i use wait() before for the loop starts, it’s worked. Yeah i know i don’t wanna use wait() either but i couldn’t finy any other solution.

1 Like