(This is a repost, don't worry I deleted the original post)
local text = script.Parent.Text local status = script.Parent.StatusValue.Value if text ~= status then for i = 1, string.len(status) do text = string.sub(status, 1, i) wait(0.04) --This is the speed of the text end end
Hello there, my problem is that the text isn't even appearing and the text that was originally there stays there. I've tried fixing this, and yet it isn't working and I have no idea as of why it isn't. I mean, I've gotten to the point of changing the status variable to camelCase cause I have no idea.
This is a script (I've tried changing it to a local script and it hasn't worked either) in a text label named "TextStatus" which also has a string value named "StatusValue" which will hold the status (text) that is supposed to be in the text variable in "TextStatus"
Thank you for reading this,
Narwhal
EDIT: I'm new to this "for i = 1, string.len(status) do" stuff, also "for i,v in pairs do" (sorry if I said it wrong), type stuff. also thanks for help RiskoZoSlovenska! '
Your code is actually perfectly fine except for one part.
The text
variable is your problem because you are referring to the TextLabel's text and storing it inside a variable, so when you change that variable, you think you are changing the text, but you are actually just changing the variable.
To fix this you just have to define text as
local text = script.Parent
Then when you are trying to modify the text, you add the .Text
in there
if text.Text ~= status then -- here for i = 1, string.len(status) do text.Text = string.sub(status, 1, i) -- and here wait(0.04) --This is the speed of the text end end
That should fix it, if you have any questions please let me know