0
\$\begingroup\$

while I was implementing the Backback save feature in my Roblox Game (using game.Players.PlayerRemoving:Connect(), I found that when I used a loop of any form (for, while,etc.), it would not run correctly. Here is a test program which I wrote to observe this issue:

game.Players.PlayerRemoving:Connect(function(player)
    local testList = {"Hello", ",", "world"}
    for i=1,3,1
    do
        print(testList[i])
    end
end)

However, when this code is ran, all I see in the output window is:

Hello

And nothing else. This issue is causing a lot of issues with the rest of the code, can somebody please help? It would be very useful!

\$\endgroup\$
1
\$\begingroup\$

I tested the code as I didn't see anything wrong with it and it works fine. Be sure to check if there are any yields, breaks, anything that could stop PlayerRemoving event from firing / executing the whole code.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ I am afraid the code I posted at the top is it, and yet I only get one Hello. \$\endgroup\$ – sciencepi May 28 at 15:37
  • \$\begingroup\$ As I said works fine for me. Your studio may have an issue maybe your studio is bugged? try re installing or testing in a real game , if it works there it means your studio is bugged and has to be re installed. \$\endgroup\$ – Prexxo May 28 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.