I’m not too sure what you’re asking here. Could you elaborate on what you’re trying to do and maybe show a bit more of the code? I’m not sure how you’re defining clonedAbility.
I see, I don’t think you should do it relying on variables created from a different function as you’re working with many scopes and you might notice other peoples’ waves will interfere with each other. You should probably do it in order and create the coroutine inside of the function so it doesn’t yield until the tween is over. So something like:
local function summonWave(player, playerPos)
task.wait(0.5)
-- continue for rest of function
-- also ensure you're defining variables inside this function using local
local tween = TS:Create(...)
tween:Play()
coroutine.resume(coroutine.create() -- you can also use task.spawn/task.delay/coroutine.wrap/create a connection using signal:Once for something a little neater
tween.Completed:Wait()
rootPart:Destroy()
end))
return playerPos
end
remote.OnServerInvoke = summonWave