Hello fellow developers, so I’ve been starting to make an attack recently, but the issue is that my spawn function doesn’t work. Here’s what I mean, I want my vfx to spin and grow at the same time, for this I made a repeating loop for the spin (so it doesnt go infinitely) and then used the spawn function and after that I wrote my tween, the problem is that the tween plays and then the vfx spins, heres my script:
script.Parent.OnServerEvent:Connect(function(plr)
print("Fired Rengoku Attack")
local char = plr.Character
local hum = char.Humanoid
local root = char.HumanoidRootPart
local vfx = game.Lighting.BulletVFX:Clone()
local ts = game:GetService("TweenService")
vfx.CFrame = root.CFrame
vfx.Parent = workspace
local function spinvfx()
for i = 1,1800 do
vfx.CFrame = vfx.CFrame * CFrame.fromEulerAnglesXYZ(0,0.5,0)
wait()
end
end
spawn(spinvfx)
local info = TweenInfo.new(1,Enum.EasingStyle.Sine,Enum.EasingDirection.In,0,false,0)
local properties = {
Size = Vector3.new(26, 80, 30);
CFrame = vfx.CFrame * CFrame.new(0,40,0)
}
ts:Create(vfx,info,properties):Play()
end)
I’m still getting the same result where it completes the tween and then spins, should I just put a spin script in its own script and insert it into the vfx?