Through a seperate script, I need skips to be accessed as a number. I also need it to be saved through datastore so I don’t know if a label would work.
I’m not sure if this would work, but you could try to make a folder inside of the leaderstats, (I would call it “HiddenValues”) and put the Skips inside of there.
Attributes can be get and set by GetAttribute and SetAttribute, where you simply set the attribute’s value to a number and can later retrieve it with GetAttribute. You can create an attribute for the leaderstats folder and then you can set it to the value you want.
game.Players.PlayerAdded:Connect(function(plr)
local toolsOwned = {}
local coins = 0
local wins = 0
local skips = 0
pcall(function()
toolsOwned = ds:GetAsync("tools-" .. plr.UserId) or {}
coins = ds:GetAsync("coins-" .. plr.UserId) or 0
wins = ds:GetAsync("wins-" .. plr.UserId) or 0
skips = ds:GetAsync("skips-" .. plr.UserId) or 0 -- Get the skips
end)
local ls = Instance.new("Folder", plr)
ls.Name = "leaderstats"
local hs = Instance.new("Folder", plr) -- Stats folder which won't appear on leaderstats
hs.Name = "HiddenStats"
local coinsValue = Instance.new("IntValue", ls)
coinsValue.Name = "Coins"
coinsValue.Value = coins
local winsValue = Instance.new("IntValue", ls)
winsValue.Name = "Wins"
winsValue.Value = wins
local skipsValue = Instance.new("IntValue", ls)
skipsValue.Name = "Skips"
skipsValue.Value = skips
skipsValue.Parent = hs -- Parent the skip value to the hidden stats
local ownedFolder2 = Instance.new("Folder", plr)
ownedFolder2.Name = "OwnedTools"
for i, owned in pairs(toolsOwned) do
if tools:FindFirstChild(owned) then
tools[owned]:Clone().Parent = ownedFolder2
end
end
end)
an explanation would be that leaderstat means leaderboard stats im guessing, and if you put it under player instead, it wouldn’t be shown on the leaderboard
this should work but if it doesn’t then it means I literally just missed something lol
As suggested here. Use attributes to store stats that you don’t want displayed.
--SAVING
local Attributes = leaderstats:GetAttributes()
for _, Child in ipairs(leaderstats:GetChildren()) do
Attributes[Child.Name] = Child.Value
end
--Save 'Attributes' table to datastore here.
--LOADING
for Key, Value in pairs(Data) do --Loaded data.
local Stat = leaderstats:FindFirstChild(Key) --Find stat inside leaderstats folder.
if Stat then --If stat exists.
Stat.Value = Value --Set stat's value to stored value.
else --If stat doesn't exist.
leaderstats:SetAttribute(Key, Value) --Set an attribute in the leaderstats folder.
end
end
This is just pseudo-code, don’t copy and paste it expecting it to work.