So there is this cash GUI that syncs with the leader stats (increases when you earn cash and decreases when you buy something), and it looks similar to the ROBLOX core GUI, I was wondering how would I make something just like it?
I dont really know much about the TopBar, But You could make a textlable like it, and in the screengui disable IgnoreGuiInset, thats all i could think of really.
And this would be the Base of the script that indicates your Money
`while wait(1) do
script.Parent.Text = '$ '…game.Players.LocalPlayer.leaderstats.Cash.Value
end`
the loop Keeps checking the players currency and places it in its parents text.
Of course my attempt isn’t perfect, but it’s a head start!
Now if you want to synchronize the TextButton's Text to the player’s leaderstatsCash, then yeah you need a little scripting. Assuming you already have your leaderstats system setup, setup a Changed event with your CashValueObject:
-- LocalScript
local players = game:GetService("Players")
local player = players.LocalPlayer
local leaderstats = player.leaderstats
local cashValueObj = leaderstats.Cash
local textButton = -- Reference to the TextButton in the structure above
cashValueObj.Changed:Connect(function()
textButton.Text = cashValueObj.Value
end)
Your server side code would be responsible for changing the CashValueObject, so I didn’t show it here. Note: Everything I’ve demo’d are just examples you use as references, not necessarily things to copy and paste.
Make a screengui
Make it’s IgnoreGuiInset property to true
Put a frame in it and set it’s anchorpoint to 0.5,0
Put it in the middle-top of the screen
Make the frame’s color dark-ish
Add a ui corner and make it semi transparent
Add a textlabel into it with transparent background/centered
Update the textlabel’s text on your cash value changed events. (Assuming your using an intvalue)
Hi! Here’s the solution to your question. I expect that you’ve already made the leaderstat and gui
local LocalPlayer = game:GetService("Players").LocalPlayer
local leaderstats = LocalPlayer:WaitForChild("leaderstats")
local Money = leaderstats:WaitForChild("Money")
local MoneyTextLabel = ... -- define the path here yourself
Money:GetPropertyChangedSignal("Value"):Connect(function()
MoneyTextLabel.Text = "$"..Money.Value
end)