Points and Ranks Leaderstats

I am making a cafe game with points and the rank of a player. in leaderstats. The script I am using with my points system however will only work if the points leaderstats is its own script. However when there is 2 seperate scripts for points and ranks only one will work due to int values. so if anyone can help or find a way to make them seperate scripts then I’d love to hear it. By the way here is the 1 script with both of them in right now.

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

local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = plr

local role = Instance.new("StringValue")
role.Name = "Rank"

role.Value = plr:GetRoleInGroup(34574131) 

leaderstats.Parent = plr
role.Parent = leaderstats

local points = Instance.new("NumberValue")
points.Name = "Points"
points.Parent = leaderstats

end)

aight bet
points script:

game.Players.PlayerAdded:Connect(function(plr)
    local leaderstats = plr:FindFirstChild("leaderstats")
    if not leaderstats then
        leaderstats = Instance.new("Folder")
        leaderstats.Name = "leaderstats"
        leaderstats.Parent = plr
    end

    local points = Instance.new("NumberValue")
    points.Name = "Points"
    points.Parent = leaderstats
end)

rank script:

game.Players.PlayerAdded:Connect(function(plr)
    local leaderstats = plr:FindFirstChild("leaderstats")
    if not leaderstats then
        leaderstats = Instance.new("Folder")
        leaderstats.Name = "leaderstats"
        leaderstats.Parent = plr
    end

    local role = Instance.new("StringValue")
    role.Name = "Rank"
    role.Value = plr:GetRoleInGroup(34574131)
    role.Parent = leaderstats
end)

watch 3 people reply to this about not to spoonfeed code without explaining it :exploding_head:

btw lmk if i misunderstood ur post/did smth wrong bec i barely skimmed through what you were saying and did smth off of a rough and doubtful understanding of what u exactly need

Hiya, I know this may be a bit annoying- but please avoid spoon-feeding as it isn’t really ‘helping’ them if you’re giving them the code with no explanations. :smile:

1 Like

Thanks, works just how it needed to!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.