Why wont my typewriter script update to a value?

so i have a typewriter effect and i want it to type a stringvalue everytime the value changes. it works for a few seconds but then reverts back to what it originally and overlaps the other text

the value does update but it never changes what its typing

i have this script stored in the same frame

local textvalue = game.ReplicatedStorage.ChatText.Value
local Click = script.Parent.Parent.ChatText.Chat
local TextToChange = script.Parent.TextLabel

game.ReplicatedStorage.ChatText.Changed:Connect(function()
	for i = 1, #textvalue do
		TextToChange.Text = string.sub(textvalue, 1, i)
		wait(0.04)
	end
end)

try this

local Click = script.Parent.Parent.ChatText.Chat
local TextToChange = script.Parent.TextLabel

game.ReplicatedStorage.ChatText.Changed:Connect(function()
    local textvalue = game.ReplicatedStorage.ChatText.Value

	for i = 1, #textvalue do
		TextToChange.Text = string.sub(textvalue, 1, i)
		wait(0.04)
	end
end)

or

local Click = script.Parent.Parent.ChatText.Chat
local TextToChange = script.Parent.TextLabel
local textvalue = game.ReplicatedStorage.ChatText

game.ReplicatedStorage.ChatText.Changed:Connect(function()
    local textToSay = textvalue.Value

	for i = 1, #textToSay do
		TextToChange.Text = string.sub(textToSay, 1, i)
		wait(0.04)
	end
end)
local textvalue = game.ReplicatedStorage.ChatText
local Click = script.Parent.Parent.ChatText.Chat
local TextToChange = script.Parent.TextLabel

game.ReplicatedStorage.ChatText.Changed:Connect(function()
	for i = 1, #textvalue do
		TextToChange.Text = string.sub(textvalue.Value, 1, i)
		wait(0.04)
	end
end)

Have you tryed to play the game, not in studio? That’s a frequent problem, the GUI doesn’t update in studio, but DO update in game.