I"ve tried every tutorial, I"ve done every little thing I deserve to, but can"t seem to make a money mechanism. I"m trying to make a clicker game based upon the nursery rhyme "piggy on the railway". The concept is that you (the piggy) collect rocks (the currency) by clicking on the bed of a railroad track and also protect against trains, which make you shed every one of your stones. So much, I can not seem to discover any type of method to make a currency leaderboard.

You are watching: How to make a money system in roblox


*
0
You deserve to check out the default leaderboards here (https://developer.roblox.com/articles/Leaderboards) but you can of course implement your very own GUI and way of storing values. It"s entirely up to you. gullet 471 — 2y
0
*
*

*
Alexander_Ashford 231
*

This is a money leaderboard system that saves (Credit to an AlvinBlox Tutorial.)

I have included some notes around how it functions in the manuscript. (This manuscript need to be in ServerScriptService)

```lualocal DataStoreService = game:GetService("DataStoreService")

neighborhood GameDataStore = DataStoreService:GetDataStore("GameDataStore")

--What happens when the player joins the game.

game.Players.PlayerAdded:Connect(function(player)

--Creates leaderstats

neighborhood leaderstats = Instance.new("Folder")

leaderstats.Name = "leaderstats"

leaderstats.Parent = player

--Creates the Coins leaderstat.

local Coins = Instance.new("IntValue")

Coins.Name = "Coins"

Coins.Parent = leaderstats

-- This is the part of the script that loads the information as soon as the player joins.

regional data

local Success, ErrorPost = pcall(function()

data = GameDataStore:GetAsync(player.UserId .. "-Coins")

end)

if Success then

Coins.Value = data

else

print("Tbelow was an error whilst loading data")

warn(ErrorMessage)

end

end)

--What happens as soon as the player leaves the game.

See more: Where Did The Term Lukewarm Come From, Lukewarm Definition & Meaning

game.Players.PlayerRemoving:Connect(function(player)

--This is the part that conserves the information when the player leaves.

local Success, ErrorMessage = pcall (function()

GameDataStore:SetAsync(player.UserId.."-Coins",player.leaderstats.Coins.Value)

end)

if Success then

print("Player Data Successfully Saved.")

else

print("There was an error when saving data.")

warn(ErrorMessage)

end

end)```

Tutorial which I recommfinish you follow with yourself: https://www.youtube.com/watch?v=DkYupSBUpes