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

Other leaderboard stats no longer load?

So I am trying to make this script which generates a bunch of leaderstats. The script worked flawlessly up until yesterday whne only the "Gold" value loads, why doesn't this work anymore, and how can I fix it?

Here's the (server) script:

local dsService = game:GetService("DataStoreService")
local gold = dsService:GetDataStore("gold")
local xp = dsService:GetDataStore("xp")
local xpmax = dsService:GetDataStore("xpmax")
local rank = dsService:GetDataStore("rank")

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

	local folder = Instance.new("Folder", player)
	folder.Name = "leaderstats"
	
-- GOLD AND UNBANKED GOLD
	
	local Gold = Instance.new("IntValue", folder)
	Gold.Name = "Gold"
	Gold.Value = gold:GetAsync(player.UserId) or 0
	
	-- UNBANKED - *NO NEED FOR DS*
	
	local Unbanked = Instance.new("IntValue", folder)
	Unbanked.Name = "UnbankedGold"
	Unbanked.Value = 0
	
-- RANK AND XP
	
	-- Player level; higher level, more purchases unlocked
	
	local Rank = Instance.new("IntValue", folder)
	Rank.Name = "Rank"
	Rank.Value = rank:GetAsync(player.UserId) or 0
	
	-- XP The player has
	
	local XP = Instance.new("IntValue", folder)
	XP.Name = "XP"
	XP.Value = xp:GetAsync(player.UserId) or 0
	
	print (XP.Value)
	
	-- XP Required for rank up
	
	local XPMax = Instance.new("IntValue", folder)
	XPMax.Name = "XPMax"
	XPMax.Value = (((Rank.Value*(Rank.Value - 1))/15) * 100) + 100
	
	-- Death
	
	local Character = player.Character
	local Humanoid = Character.Humanoid
	
	Humanoid:GetPropertyChangedSignal("Health"):Connect(function()
		if Humanoid.Health <= 0 then

			Unbanked.Value = 0

		end
	end)
end)

-- LEAVE

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

	local Gold = player.leaderstats.Gold
	gold:SetAsync(player.UserId, Gold.Value)
	
	local Rank = player.leaderstats.Rank
	rank:SetAsync(player.UserId, Rank.Value)
	
	local XP = player.leaderstats.XP
	xp:SetAsync(player.UserId, XP.Value)
end)

NOTE: No errors are provided at all.

1 answer

Solved: Access to save data was disabled, preventing the script from progressing past line 16. (I reenabled access to save data)

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