#Why won't my VFX emit?
1 messages · Page 1 of 1 (latest)
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
i see
** You are now Level 2! **
Where is the script located
it can if i fire it
thats why i have the on server event
and the script itself isnt a local script
Ima try to code it rq
if ya want to delay it
also the script i provided is supposed to be a mormal script
normal
gj
didnt expect that to be thee problem lol
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
wow
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
** You are now Level 7! **
ah
well
i see where you put the wait for child
but thats a folder
so
i dotn know where to put it
which one
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 +
ok