Bugs With Changing TextLabel Text

Hello! I am trying to make a system where when a StringValue In replicated storage is changed, it updates a players text label on their screen to the value of that string value. The issue is, the game says that its being updated in the output, but the text is never changed.

(It doesn’t change at the top of the screen):


image

local script inside playergui:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Status = ReplicatedStorage:WaitForChild('Status')

local TextStatus = script.Parent:WaitForChild("TopText")

TextStatus.Text = Status.Value

Status.Changed:Connect(function()
	print(Status.Value)
	TextStatus.Text = Status.Value
	print(TextStatus.Text) -- It suggests that the text label gets changed
	
end)

while true do
	TextStatus.Text = Status.Value
end

I don’t understand why the text isn’t changing if the script says the value of the text has in fact changed. Why is this happening?

1 Like

This loop seems to be changing the text to the cached version of the Status’ value. You can remove this part of the script, since you’ve already scripted it such that the text updates everytime it detects the StringValue changing.

2 Likes

Yes, i believe this is the problem. It looks like it will overwrite the TextStatus.Text with the Status.Value Continuously, Which might case issue with the Status.CHanged connection not behaving as expected

1 Like

that while loop should be crashing your game as soon as you run it. so either your editing the wrong script or maybe you just didn’t send the real one. other than that though the code looks fine

1 Like

The client is able to access the ReplicatedStorage and its descendants normally. It’s ServerStorage and ServerScriptService that the client cannot access.

1 Like

EDIT*** Ima put there here since there is no further confusion hopefully, i just Simply over looked the .Changed Which i realized when I made this post responded to sgtest. So, to put simply and i don’t go to keep responding…What i said would’ve been true had there not been the .Changed so please forgive me. I apologies for the initial confusion

1 Like

client side changes are detectable by the client, so any changes made in replicated storage will be seen by this local script and we see that thats being detected when the client prints out the value in the output. however this isnt even an issue because no line in this script makes changes to anything inside replicated storage. also this script shouldn’t even run, if it did then roblox studio would immediately crash due to the infinite while loop. the problem is most likely not in this script

1 Like

What do you mean?

The ReplicatedStorage is like bit like the Workspace - the server can make changes on the Workspace and the change gets replicated to all clients automatically, while any changes on the client will not replicate back to the server.

Any object modified in ReplicatedStorage by the server would be able to be replicated normally, just like in the Workspace.

1 Like

Just because there is a while true loop wouldn’t make the script crash immediately. It depends on what exactly is being done in the loop.

1 Like

open studio and make a local script with a while true loop right now and hit play. your studio will crash. unless a task.wait() or some other form of halting script execution is used it creates an infinite loop and studio just blows up.

1 Like

actually now that im looking a little closer at the output looks like this script is erroring with the excact problem i mentioned
image

1 Like

I noticed my original flaw in the context of what I was discussing, and I deleted my earlier post because I realized I was thinking about the issue incorrectly. As soon as I replied to sgtest7, I did a double take and realized this is a .Changed situation, meaning the client is indeed properly listening. I immediately facepalmed myself over that oversight.

That said, the rest of what I mentioned stands. I don’t see why there’s confusion about what I said. What I initially stated was flawed, but I corrected it by deleting the post before continuing.

Honestly, what should’ve been pointed out is that I may have missed the .Changed usage in the script, and I would have completely agreed and simply apologized. My thought process at the time jumped straight to using a RemoteEvent, which was a bit silly in hindsight.

1 Like

it’s pretty clear you have no clue what you’re talking about it as all of this is false, and it’s also pretty clear that you’re just using chatgpt because no real forum user talks like this

2 Likes


heres his original post before he edited it. so yeah definitely chatgpt

1 Like

When I type quickly, I may make spelling mistakes or miss a comma or two, which is why I used ChatGPT to help refine my grammar and make my response more polished. However, the original post had nothing to do with these grammatical issues—I’ve already apologized for missing the .Changed part.

In hindsight, if I had used ChatGPT earlier, it probably wouldn’t have overlooked that detail, so I should have used it from the start. Lesson learned!

1 Like

The while true loop runs infinitely which means it’s constantly updating the text. This will override the .changed function which can make it freeze or lag. Another issue is that the .text property is being changed in 2 instances which could cause one to try to override eachother.

1 Like