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

5 comments
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)
Oh, looks like your wanting the role as well...so use :GetRankInGroup() on line 11 but :GetRoleInGroup() on line 12/14
I tried making only one script create the leaderstats but It seems to break the script sorry I'm pretty bad at scripting
There is no point in splitting those into separate scripts
Is there a way to connect them? Am I missing something?