TUTORIAL #2 - Intermediate
How to make a GUI that tells you your Cash\Coin value
As you know, mobile players can not see the leaderstats. So, it’s nice to have a GUI that tells them their Coin\Cash value. This is also for ALL device users.
STEP 1: Create the leaderstats
Insert a Script into the Workspace.
To do this, click the “+” button.
Now, insert the Script. Name it ‘leaderstats’.
Insert the following code:
`
> game.Players.PlayerAdded:Connect(function(player)
`
local leaderstats = Instance.new("Folder",player)
leaderstats.Name = "leaderstats"
local coins = Instance.new("IntValue", leaderstats)
coins.Name = "Coins" -- Change name to your liking.
coins.Value = 100
end
As you can see, it does this.
STEP 2: MAKE YOUR GUI
For the sake of this tutorial, I will not show you how to make a GUI because this is not a tutorial for that.
If you would like to know how to make a GUI look at this post:
Here’s mine:
STEP 3: Coding the GUI
Now, for the final step; making the GUI that says your Coin\Cash value.
Inside your GUI insert a local script into the TextLabel.
Insert the following code:
local player = game.Players.LocalPlayer
local leaderstats = player:WaitForChild("leaderstats")
local coins = leaderstats:WaitForChild("Coins") --Change according to the Name
local text = script.Parent
text.Text = coins.Value
coins:GetPropertyChangedSignal("Value"):Connect(function()
text.Text = coins.Value
end)
STEP 4: TEST IT
If all success then;
Not only this should tell you your amount but also…
I hope this tutorial helped you. If you have any question, leave them down below.
Getting topic locked due to many reasons.