You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I think title is enough to describe it but.
I am trying to change all text labels at the same time
What is the issue? Include screenshots / videos if possible!
other Texts aren’t changing until first text reach 0
local Gui = script.Parent
local Frame = Gui:WaitForChild("Frame")
local DailyRewardsModule = require(game:GetService("ReplicatedStorage"):WaitForChild("Modules"):WaitForChild("DailyRewards"))
for i , v in pairs(Frame:GetDescendants()) do
if v:IsA("TextLabel") then
v.Text = DailyRewardsModule[v.Name]["ClaimTime"]
while tonumber(v.Text) >0 do
v.Text = v.Text - 1
task.wait(1)
end
end
end
I am not sure if I explained it good so, here is a video of the issue
local Gui = script.Parent
local Frame = Gui:WaitForChild("Frame")
local DailyRewardsModule = require(game:GetService("ReplicatedStorage"):WaitForChild("Modules"):WaitForChild("DailyRewards"))
local function TickTime(v)
v.Text = DailyRewardsModule[v.Name]["ClaimTime"]
while tonumber(v.Text) >0 do
v.Text = v.Text - 1
task.wait(1)
end
end
for i , v in pairs(Frame:GetDescendants()) do
if v:IsA("TextLabel") then
coroutine.wrap(TickTime)(v)
end
end
Of course! coroutine.wrap allows us to call functions without Yielding for them! Where your script, was waiting for one gift with task.wait(1) to finish before starting the next one. coroutine.wrap just called all the functions at the same time, to start together