My LeaderBoard/GroupRank Leaderboard wont work whats wrong?
So I have a leaderboard with 2 IntValue's and a BoolValue for a Group rank, but the BoolValue part won't work with the intValue's, but it does not tell me why. What went wrong. Here is the Script. (P.S. the IntValues still work.)
---Script---
01 | local DataStoreService = game:GetService( "DataStoreService" ) |
03 | local myDataStore = DataStoreService:GetDataStore( "myDataStore" ) |
05 | game.Players.PlayerAdded:Connect( function (player) |
06 | local leaderstats = Instance.new( "Folder" ) |
07 | leaderstats.Name = "leaderstats" |
08 | leaderstats.Parent = player |
10 | local cash = Instance.new( "IntValue" ) |
12 | cash.Parent = leaderstats |
15 | local cash = Instance.new( "IntValue" ) |
17 | cash.Parent = leaderstats |
20 | local Rank = Instance.new( "BoolValue" , leaderstats) |
22 | Rank.Value = player:GetRoleInGroup( 5081083 ) |
25 | local success, errormessage = pcall ( function () |
26 | data = myDataStore:GetAsync(player.UserId.. "-cash" ) |
32 | print ( "There was a error whilst getting your data" ) |
37 | game.Players.PlayerRemoving:Connect( function (player) |
39 | local success, errormessage = pcall ( function () |
40 | myDataStore:SetAsync(player.UserId.. "-cash" ,player.leaderstats.Cash.Value) |
44 | print ( "Player Data successfully saved!" ) |
46 | print ( "There was a error when saving data" ) |