I read somewhere that using :Wait() along with an event would significantly improve performance compared to just using wait(). I'm wondering if the line of codes that i wrote has any difference and which one is more practical?
First code
local number = 0
spawn(function()
repeat wait() until number == 10
print('Ten!')
end)
for i = 1,10 do
wait(1)
number = number + 1
print(number)
end
Second code
local runService = game:GetService('RunService')
local number = 0
spawn(function()
repeat runService.Stepped:Wait() until number == 10
print('Ten!')
end)
for i = 1,10 do
wait(1)
number = number + 1
print(number)
end

1 comment
:Wait() is a method of RBXScriptSignal. It is a yield function, meaning it will pause the current Lua thread until a response is returned from the event.