Hey everyone, I’ve been trying to make a leaderboard thing put a user’s role in a rank on the leaderboard, though it puts it as “0”.
I’ve tried switching up the values in my code, though it didn’t work out.
Here’s my current full code, help is appreciated:
-- variables
local datastore = game:GetService("DataStoreService")
local ds1 = datastore:GetDataStore("TimeSaveSystem")
local function onPlayerJoin(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local gold = Instance.new("IntValue")
gold.Name = "Rank"
gold.Value = player:GetRoleInGroup(5008838)
gold.Parent = leaderstats
local mins = Instance.new("IntValue")
mins.Name = "Minutes"
mins.Value = ds1:GetAsync(player.UserId) or 0
ds1:SetAsync(player.UserId, mins.Value)
mins.Parent = leaderstats
mins.Changed:connect(function()
ds1:SetAsync(player.UserId, mins.Value)
end)
end
game.Players.PlayerAdded:Connect(onPlayerJoin)
Any help is appreciated, thank you everyone.