So I have a script that calls a function, but I have a wait function inside the function. Because of this the rest of the script won’t run until the function is done. I’m just wondering if there is a way to make functions async so this won’t happen.
--Inside the function-------
local function tween()
local info = TweenInfo.new(
0.2,
Enum.EasingStyle.Quad,
Enum.EasingDirection.InOut)
local goal = {}
goal.Size = Vector3.new(30,1024,30)
goal.Transparency = 0.6
script["ES_Hit Impact Blast - SFX Producer"]:Play()
local tween = TweenService:Create(circle,info,goal)
tween:Play()
local tween2 = TweenService:Create(circle2,info,{Size = Vector3.new(30,0.5,30)})
tween2:Play()
touch = false
wait(2)
local info2 = TweenInfo.new(1)
local tween = TweenService:Create(circle,info2,{Transparency = 1})
tween:Play()
local tween2 = TweenService:Create(circle2,info2,{Transparency = 1})
tween2:Play()
tween2.Completed:Wait()
circle:Destroy()
circle2:Destroy()
end
--Outside the function-------
tween(player)
task.wait(0.25)
print("server")