Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you make multiple of a currency system ?

local RubiesName = "Rubies"
local HonorPointsName = "Honor Points"
local DS = game:GetService("DataStoreService"):GetDataStore("TestDataStore")

game.Players.PlayerAdded:Connect(function(players)
	local Folder = Instance.new("Folder")
	Folder.Name = "Stats"
	Folder.Parent = players
	
	local Rubies = Instance.new("IntValue")
	Rubies.Name = RubiesName
	Rubies.Parent = Folder
	
	local Honor_Points = Instance.new("IntValue")
	Honor_Points.Name = HonorPointsName
	Honor_Points.Parent = Folder
	
	local ID_1 = RubiesName.."-"..players.UserId
	local ID_2 = HonorPointsName.."-"..players.UserId
	local savedData_1 = nil
	local savedData_2 = nil
	pcall(function()
		savedData_1 = DS:GetAsync(ID_1)
		savedData_2 =DS:GetAsync(ID_2)
	end)
	if savedData_1 ~= nil then
		Rubies.Value = savedData_1
		Honor_Points.Value = savedData_2
	else
		Honor_Points.Value = 50
		Rubies.Value = 50
	end
end)
game.Players.PlayerRemoving:Connect(function(players)
	local ID_1 = RubiesName.."-"..players.UserID
	local ID_2 = HonorPointsName.."-"..players.UserID
	DS:SetAsync(ID_1,players.Stats[RubiesName].Value)
	DS:SetAsync(ID_2,players.Stats[HonorPointsName].Value)
end)

Im trying to make multiple currency systems , i've only made a system when there's only 1 currency , i tried making 2 currency systems , but instead of showing up , the leader board has nothing just blank space . There aren't any errors , how can i fix this ?

2 comments

0

change the name of folder to leaderstats

0

Answer the question to he can give you the solution if it works.

1 answer

✓ Accepted answer

Call the folder "leaderstats".

This discussion is preserved as it was. New answers, comments, and votes are closed.