Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make these two scripts work on the leaderboard?

Asked by 4 years ago
Edited 4 years ago

I want it to appear on my leaderboard but I have a group rank script too and when I add this script the rank script becomes blank

game.Players.PlayerAdded:connect(function(p)
local stats = Instance.new("IntValue", p)
stats.Name = "leaderstats"
local money = Instance.new("IntValue", stats)
money.Name = "Cash"
money.Value = 0
while true do
wait(80)
money.Value = money.Value + 50
end
end)

And here is the group script that doesn't work when I use the money script

local playerStats = {}

 game.Players.PlayerAdded:connect(function(player)
     local leaderstats = Instance.new("Model", player)
     leaderstats.Name = "leaderstats"

     local grouprank = Instance.new("StringValue", leaderstats)
     grouprank.Name = "Rank" 
     local rank = player:GetRoleInGroup()  --My group

     if rank ~= 0 then
         grouprank.Value = rank
     else
         grouprank.Value = "Guest" 
     end

     playerStats[player] = leaderstats 
 end)

For some reason both scripts work once in studio and then they stop working

0
if you use both scripts at the same time only have one create leaderstats. If you have two it will screw up the leaderboard....also in the second script use :GetRankInGroup() instead, :GetRoleInGroup() returns the role name(looks like your wanting the rank value) ForeverBrown 356 — 4y
0
Oh, looks like your wanting the role as well...so use :GetRankInGroup() on line 11 but :GetRoleInGroup() on line 12/14 ForeverBrown 356 — 4y
0
I tried making only one script create the leaderstats but It seems to break the script sorry I'm pretty bad at scripting WiryIndriunas 0 — 4y
0
There is no point in splitting those into separate scripts nc2r 117 — 4y
0
Is there a way to connect them? Am I missing something? WiryIndriunas 0 — 4y

Answer this question