sorry if this is a really simple question, I haven’t been coding in a couple months so I’m a bit rusty.
So i’ trying to make an attack where if the player misses, then the VFX ends early, However with the for loop that I’m using it will immediately choose to keep or end the VFX early based on the first part that is in the radius.
Code:
for i, v in ipairs(parts) do
if v.Parent then
if v.Parent:FindFirstChild("Humanoid") and v.Parent ~= char then
local remote = game:GetService("ReplicatedStorage"):FindFirstChild("Remotes"):FindFirstChild("Attack")
remote:FireServer(v.Parent)
else
end
else
script.Parent.noise2:Play()
humanoid.WalkSpeed = 16
game.TweenService:Create(Motor6D, TweenInfo.new(0.2), {C0 = CFrame.new(2.5, -1, -3)}):Play()
for i, v in ipairs(FreezeVFX:GetDescendants()) do
if v:IsA("ParticleEmitter") then
game.TweenService:Create(v, TweenInfo.new(1), {Rate = 0}):Play()
end
end
game.TweenService:Create(script.Parent.noise2, TweenInfo.new(1), {Volume = 0}):Play()
task.wait(1)
script.Parent.noise2:Stop()
FreezeVFX:Destroy()
end
end