ive been working on a 3d platformer and I have always wondered how people make those custom currency ui’s that save since I thought the only way to use datastores was with leaderstat
anyways is there a way to make text on a text label display the value of a leaderstat?
im not sure how to code but im guessing you would just check the value of the leaderstats and then change the Text property of the textlabel to display the value
You pretty much have it there, put a local script inside of your text label and make a while loop that updates the text label’s text to the leaderstats value every second.
leaderstatVal.Changed:Connect(function() -- replace leaderstatVal with your value
textlabel.Text = leaderstatVal.Value -- .Value if leaderstatVal is instance, without if variable
end)
Also make sure to have the same code outside the changed-function, to initialize the textbox text. Meaning it would be empty until leaderstatVal got updated otherwise.
leaderstatVal.Changed:Connect(function() -- replace leaderstatVal with your value
textlabel.Text = leaderstatVal.Value -- .Value if leaderstatVal is instance, without if variable
end)
textlabel.Text = leaderstatVal.Value -- .Value if leaderstatVal is instance, without if variable
local plr = game.Players.LocalPlayer -- Assuming the script is local.
local leaderstats = plr:WaitForChild("leaderstats")
local money = leaderstats:WaitForChild("(money name here!)")
local textlabel = (display here!)
money:GetPropertyChangedSignal("Value"):Connect(function()
textlabel.Text = money.Value
end)