Alright, I could really use a solution. This is driving me mad! What is the issue? Solution, please...

local Players = game.GetService("Players")
local function onPlayerAdded(player)
local DataStore = game:GetService("DataStoreService")
local ds1 = DataStore:GetDataStore("ExperienceSaveSystem")
local ds2 = DataStore:GetDataStore("WealthSaveSystem")
local ds3 = DataStore:GetDataStore("LevelSaveSystem")

	local leaderstats = instance.new("Folder")
		leaderstats.Name = "leaderstats"
	local Experience = instance.new("IntValue")
		Experience.Name = "Experience"
			Experience.Value = 0
	local Wealth = instance.new("IntValue")
		Wealth.Name = "Wealth"
			Wealth.Value = 0
	local Level = instance.new("IntValue")
		Level.Name = "Level"
			Level.Value = 1
		
		Level.Parent = leaderstats
		Wealth.Parent = leaderstats
		Experience.Parent = leaderstats
		leaderstats.Parent = Player
		
		Experience.Value = ds1:GetAsync(Player.UserId) or 0
	ds1:SetAsync(Player.UserId, Experience.Value)
	Experience.Changed:Connect(function() end)
		ds1:SetAsync(Player.UserId, Experience.Value);
	
		Wealth.Value = ds2:GetAsync(Player.UserId) or 0
	ds2:SetAsync(Player.UserId, Wealth.Value)
	Wealth.Changed:Connect(function() end)
		ds2:SetAsync(Player.UserId, Wealth.Value);
	
		Level.Value = ds3:GetAsync(Player.UserId) or 0
	ds3:SetAsync(Player.UserId, Level.Value)
	Level.Changed:Connect(function() end)
		ds3:SetAsync(Player.UserId, Level.Value);
	end)
end)


game.Players.PlayerRemoving:Connect(function(Player)
	ds1:SetAsync(Player.UserId, Player.leaderstats.Experience.Value)
	ds2:SetAsync(Player.UserId, Player.leaderstats.Wealth.Value)
	ds3:SetAsync(Player.UserId, Player.leaderstats.Level.Value)
	for _, player in pairs(Players:GetPlayers()) do
	onPlayerAdded(player)
end

Players.PlayerAdded:Connect(onPlayerAdded)
end)


6 comments

0

In-script solution is especially helpful, thx.

0

What's the problem?

0

What's the problem?

0

It won't display the leaderstats, regardless create the leaderstat folder, nor do literally anything it is supposed to...

0

Tbh, I'm extremely confused. Can you elaborate on the link you sent me by chance?