while true do
wait(1)
script.Parent.Text = "heat.."(workspace.Heat.Value)"
end
COMMUNITY QUESTION
how to display a value on a surface gui?
2 answers
You have to first add a TextLabel to a SurfaceGui, then you have to add a localscript inside the text label. In the localscript, add:
while wait(0.01) do
script.Parent.Text = workspace.Heat.Value
end
You had it right, just don't use while true since that can crash the game.
I would do something else than a loop.
Instead of doing a loop and slowing down the game, use .Changed. It will prevent from doing loops for no reason
workspace.Heat.Changed:Connect(function()
script.Parent.Text = "Heat: "..workspace.Heat.Value
end)
Or use GetPropertyChangedSignal
workspace.Heat:GetPropertyChangedSignal("Value"):Connect(function()
script.Parent.Text = "Heat: "..workspace.Heat.Value
end)
I would use these over a while loop and technically, it would change it instantly after it changed and not "0.01" seconds
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
GetPropertyChangedSignal is better than Changed