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

I cannot get the billboard gui to update while playing the game in roblox studio can someone help?

Asked by 3 years ago

here is the link to a image of the problem https://ibb.co/g3LpvfH

here is the script:game.StarterGui:WaitForChild('BillboardGui').TextLabel.Text = 'Level '.. level.Value

keep inmind this a part of the already made level system

2 answers

Log in to vote
0
Answered by
bdam3000 125
3 years ago
Edited 3 years ago

You are trying to get the gui in game.StarterGui

The contents in StarterGui is what the player spawns with. You can simply fix it by changing the path to Player.PlayerGui which is the GUIs that the player sees

local Player = -- put player path here

Player:WaitForChild('PlayerGui'):WaitForChild('BillboardGui').TextLabel.Text = 'Level '.. level.Value

Now, to update the Gui every time your level changes. You can use the GetPropertyChangedSignal to detect when a certain property is changed in an instance

So,

local Player = -- put player path here


level:GetPropertyChangedSignal('Value'):Connect(function()
    Player:WaitForChild('PlayerGui'):WaitForChild('BillboardGui').TextLabel.Text = 'Level '.. level.Value

end
0
edited bdam3000 125 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

Well, part of it is that you have no loop to keep your script updated. What I would do is put in a "while true do" loop, with a "wait" statement in the loop. Also, you'll want to follow what the other guy is saying, but I would also put the script inside the text label you want to have updating. But take what I'm saying with a grain of salt, because I'm only 60% sure I know what you're trying to say.

local Player = -- put player path here

while true do
    level:GetPropertyChangedSignal('Value'):Connect(function()
    Player:WaitForChild('PlayerGui'):WaitForChild('BillboardGui').TextLabel.Text = 'Level '.. level.Value
    wait(1)
end
0
when i do while true do with the wait it says this Script timeout: exhausted allowed execution time simple1234ui -2 — 3y

Answer this question