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

How to make textlabel update text?

Asked by 3 years ago

im making a simulator game and i want a textlabel to display IntValue's value it does actually display it but when it changes the value doesnt update i really need help and sorry if i made a dumb mistake im really new to scripting Script:

script.Parent.Text = game.StarterPack.Pizza.FoodCount.Value

1 answer

Log in to vote
0
Answered by 3 years ago
local Player = game.Players.LocalPlayer
local Backpack = Player:WaitForChild("Backpack") --tools in StarterPack will be cloned into Player's backpack
local Pizza = Backpack:WaitForChild("Pizza")

Pizza.FoodCount:GetPropertyChangedSignal("Value"):Connect(function() --this will run everytimes the value is changed
    script.Parent.Text = Pizza.FoodCount.Value
end)

The script must be LocalScript to work with player's GUI.

0
thank you so much Mantery123 9 — 3y
0
Wait the text starts of with label but when you click it does actually change how do i fix that Mantery123 9 — 3y
0
@Mantery123 keep it blank before you test the game 1ofm12ck53 75 — 3y
0
okeh Mantery123 9 — 3y
Ad

Answer this question