How to make script for giving leaderstats Cash if have game pass?

tacotaco

New Member
Mar 15, 2018
10
0
1
Roblox
Joshly_taken
I used to have an old one that works but after the game pass update it broke?

Any help? Please and thank you!

What I mean: You have a game pass, the script checks if you have that game pass, if so gives you Cash from the leader stats.
 

MythicalShade

Member
Nov 10, 2018
111
11
18
Roblox
MythicalShade
I didn't check to see if this works, but try it anyways and remember to change the GamePassID variable.
Code:
local PlayerService = game:GetService("Players")
local MarketService = game:GetService("MarketplaceService")

local GamePassID = 1234567 -- Change this to your GamePassID

PlayerService.PlayerAdded:Connect(function(player)
    if MarketService:UserOwnsGamePassAsync(player.UserId, GamePassID) then -- Uses "UserOwnsGamePassAsync(userId, gamepassId)" to check if player has gamepass
        player.leaderstats.Money.Value = player.leaderstats.Money.Value + 10 -- Add Money
    end
end)
 

tacotaco

New Member
Mar 15, 2018
10
0
1
Roblox
Joshly_taken
I didn't check to see if this works, but try it anyways and remember to change the GamePassID variable.
Code:
local PlayerService = game:GetService("Players")
local MarketService = game:GetService("MarketplaceService")

local GamePassID = 1234567 -- Change this to your GamePassID

PlayerService.PlayerAdded:Connect(function(player)
    if MarketService:UserOwnsGamePassAsync(player.UserId, GamePassID) then -- Uses "UserOwnsGamePassAsync(userId, gamepassId)" to check if player has gamepass
        player.leaderstats.Money.Value = player.leaderstats.Money.Value + 10 -- Add Money
    end
end)
didn't work, oh well
 

MythicalShade

Member
Nov 10, 2018
111
11
18
Roblox
MythicalShade
I didn't check to see if this works, but try it anyways and remember to change the GamePassID variable.
Code:
local PlayerService = game:GetService("Players")
local MarketService = game:GetService("MarketplaceService")

local GamePassID = 1234567 -- Change this to your GamePassID

PlayerService.PlayerAdded:Connect(function(player)
    if MarketService:UserOwnsGamePassAsync(player.UserId, GamePassID) then -- Uses "UserOwnsGamePassAsync(userId, gamepassId)" to check if player has gamepass
        player.leaderstats.Money.Value = player.leaderstats.Money.Value + 10 -- Add Money
    end
end)
didn't work, oh well
Did you edit the script? I don't know where the cash value is so I just added it to a random value in leaderstats, also you need to change the gamepassId if you didn't.