✓ Accepted answer
Instead of repeating the same line of code you could use some useful Roblox functions to make it much easier. string.rep concatenates 'x' times of a string together which then returns that string.
If I wanted to concatenate 'Hello' 3 times together, I could do:
local text = string.rep("Hello", 3)
print(text)
We can use this in the while-loop to form the animated ellipsis effect:
local count = 0
local text
while true do
text = "Loading"..string.rep(".", count)
print(text)
count = (count + 1) % 4
wait(1)
end
On line 6, we use to calculate the count we're on by getting the remainder of count divided by 4 (Search the modulus operator for more).
####So if we were on count 3. We add 1 to get 4 and divide by 4 which leaves no remainder making count 0 again.
The reason your Text may not be changing could be found by adding a few prints() to debug what does run. Like inside the if-statement on line 5 or checking to see your variable paths are right.
Remember that the while-loop is infinite so you will need something to break it.
The finished script should look something like:
local loadLabel= script.Parent
local count = 0
while true do
loadLabel.Text = string.rep(".", count)
count = (count + 1) % 4
wait(1)
end
3 comments
Also can someone actually leave an ANSWER instead of a comment?
is this a local script?
Yup