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

Why Isn't the Text updating in my SurfaceGUI script?

So basically I have this loop that checks what the value of this string value is. It takes that value and makes it the text. Oddly, it works for when I first join the game but then when I change the value in-game via explorer it doesn't update. This is a server script located inside the screen GUI.

while wait(0.1) do -- the wait is so the game won't crash
	local CurrentOwner = script.Parent.Parent.Parent.Parent.Parent.CurrentOwner -- variables
	local TEXTLABEL = script.Parent.TextLabel
	
	TEXTLABEL.Text = CurrentOwner.Value
end

If this is an easy fix please let me know as it would help a lot!

1 comment

0

Try using .Changed

1 answer

✓ Accepted answer

Maybe try using tostring

while wait(0.1) do -- the wait is so the game won't crash
    local CurrentOwner = script.Parent.Parent.Parent.Parent.Parent.CurrentOwner -- variables
    local TEXTLABEL = script.Parent.TextLabel

    TEXTLABEL.Text = tostring(CurrentOwner.Value)
end

and also if you want a faster wait time you could do

while true do
    game:GetService("RunService").Heartbeat:Wait()
    local CurrentOwner = script.Parent.Parent.Parent.Parent.Parent.CurrentOwner -- variables
    local TEXTLABEL = script.Parent.TextLabel

    TEXTLABEL.Text = tostring(CurrentOwner.Value)
end

1 comment

0

Interesting... oddly neither of those seem to work. :( thanks a lot for you help though. The text changes when I first join the game in Roblox Studio but once I changed the value it didn't do anything.

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