Hi guys, A bit of help is needed here.
I have a script that uses RemoteFunctions. Everything works on the server side, and most of it on the client side. The problem i have is that I have a for loop in the client script that isnt running. It did work at some point but it no longer does. The script works fine, but it just skips the for loop, and its something I really need to have working. Please see the code below. any help would be appreciated!
This is the for loop
for i = 1,120,-1 do script.Parent.Submit.Text = "YOU MUST WAIT "..i.." SECONDS" wait(1) end
This is the script which the for loop is in.
debounce = false script.Parent.Submit.MouseButton1Click:connect(function() if debounce == false then debounce = true script.Parent.Submit.Text = "SENDING. PLASE WAIT..." local reportedplr = script.Parent.ReportPlayer.Text local details = script.Parent.ReportReason.Text local API_Sender = game.ReplicatedStorage.ReportAPI_Config.DiscordReportAPI local result = API_Sender:InvokeServer(reportedplr,details) if result == "ok" then script.Parent.Submit.Text = "SENT!" else script.Parent.Submit.Text = "ERROR SENDING REPORT, TRY AGAIN" print(result) end wait(5) for i = 1,120,-1 do script.Parent.Submit.Text = "YOU MUST WAIT "..i.." SECONDS" wait(1) end script.Parent.Submit.Text = "SUBMIT" debounce = false end end)
You're doing the for loop other way around.
it should be
for i = 120, 1, -1 do script.Parent.Submit.Text = "YOU MUST WAIT "..i.." SECONDS" wait(1) end
Your current method would count from 1 to 120 in a -1, even explaining it would sound confusing.
If my solution didn't work, then the problem is probably not the for loop, you might want to check if there's any parts underlined or there's an error output.
Hope this helps!