Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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!

0
Try using .Changed AntiWorldliness 868 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

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
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. sbob12345m 59 — 4y
Ad

Answer this question