Greetings,
I worked on a saving screen and I tried making this text change until the event occurs. But the code does not repeat. Please help me!
The code:
repeat
text.Text = "Saving your progress"
wait(0.1)
text.Text = "Saving your progress."
wait(0.1)
text.Text = "Saving your progress.."
wait(0.1)
text.Text = "Saving your progress..."
wait(0.1)
until RSFS.OnClientEvent
local base = "Saving your progress";
local append = "...";
local toStop = false;
RSFS.OnClientEvent:Connect(function()
toStop = true;
end);
local i = 1;
while true do
if toStop then break; end
text.Text = base .. append:sub(1, i % (#append + 1));
i += 1;
task.wait(0.1);
end
I haven’t tested this out but it should theoretically work.
The reason your script doesn’t work is because RSFS.OnClientEvent is not a boolean, it’s an event. Since it’s an event, adding until RSFS.OnClientEvent doesn’t make it loop again since it does exist so there is no reason to loop again.
Edit: changed #append to (#append + 1) after a quick test
4 Likes
Thanks! Though I found a simpler way since the one script that takes control over the save button triggers 2 events (one bindable event for the GUIs and another remote event for the saving script) and used local loading = true (or false) to control the text. Thanks anyway!
1 Like