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

Gui text not changing to value?

This code isnt working for some reason. No error. its supposed to change the text of a gui to the value of a string value every time the value is changed.

local Status = script.Parent.Status
local Player = script.Parent.Parent.Parent.Parent
local StatusVal = game.Workspace.GameV2.Status.Value

while true do
	Status.Text = StatusVal
end)

2 answers

✓ Accepted answer

As Rexbit said, you neep a wait in your loop and i also think you should have a >WaitForChild("")< so that it works online. Hope I helped

local Status = script.Parent:WaitForChild("Status")
local Player = script.Parent.Parent.Parent.Parent
local StatusVal = game.Workspace.GameV2.Status

StatusVal.Changed:connect(function(value)
    Status.Text = value
end)

In loops, a wait is always needed, otherwise the studio will crash. Another point-out, a loop continues looping, never to stop unless broken up by a break, thus preventing the loop to update it's current code within.

local Status = script.Parent.Status
local Player = script.Parent.Parent.Parent.Parent
local StatusVal = game.Workspace.GameV2.Status

StatusVal.Value.Changed:connect(function(value)
	Status.Text = value
end)

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