Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How come a textlabel's text won't update? (Tried with printing)

Here's my script;

local Clicker = script.Parent:WaitForChild("ClickDetector")
local QuestionMarkString1 = game.ReplicatedStorage:WaitForChild("TextStringValues").QuestionMarkClickGiver.QuestionMarkString1.Value
local QuestionMarkString1Length = string.len(QuestionMarkString1)
local ChatGui = game.ReplicatedStorage:WaitForChild("ScreenGuis").ChatGui
local ChatBubble = ChatGui:WaitForChild("ChatBubble")
local YesNoGui = game.ReplicatedStorage:WaitForChild("ScreenGuis").YesNoGui
local YesButton = YesNoGui:WaitForChild("YesButton")
local NoButton = YesNoGui:WaitForChild("NoButton")
local ChatGuiCloned = false
local YesNoGuiCloned = false

Clicker.MouseClick:connect(function(Clicked)
	if not ChatGuiCloned then
		local CloneChatGui = ChatGui:Clone()
		CloneChatGui.Parent = Clicked.PlayerGui
		ChatGuiCloned = true
		print("ChatGui has been Cloned, ChatGuiCloned has been set to true")
		if not YesNoGuiCloned then
			local CloneYesNoGui = YesNoGui:Clone()
			CloneYesNoGui.Parent = Clicked.PlayerGui
			YesNoGuiCloned = true
			print("YesNoGui has been Cloned, YesNoGuiCloned has been set to true")
			for i = 1,QuestionMarkString1Length do
				wait()
				ChatBubble.Text = string.sub(QuestionMarkString1, 1, i)
			end
		end
	end
end)

Dunno why it won't work, no errors a script inside a click detector

1 answer

✓ Accepted answer
string.animate = function(input)
    local newText = ""
    local index = 1
    return function()
        if index<#input then
            newText = newText..string.sub(input,index,index)
            index = index + 1
            return newText
        end
    end
end

for text in string.animate("Epic!") do
    print(text)
    wait(0.1)
end

This discussion is preserved as it was. New answers, comments, and votes are closed.