I really need someone to help me make a 2x gamepass. I’ve tried many tutorials and nothing has worked. Any help would be great!
4 Likes
What code do you have that increases the player money normally?
Generally, you need to check (when a player joins, and possibly at regular intevals) if the player has the gamepass. Then, if they do, any time they recieve money, add a *2 to the value that it is incrementing by
1 Like
Think of we are increasing people money as such:
while true do
wait(40)
player.leaderstats.Money.Value = player.leaderstats.Money.Value + 1
end
One of the ways we could do this is as following:
local mPS = game:GetService('MarketplaceService')
local income = 500
while true do
wait(40)
if mPS:UserOwnsGamePassAsync(plr.UserId, gamepassID) then
player.leaderstats.Money.Value = player.leaderstats.Money.Value + (income * 2)
else
player.leaderstats.Money.Value = player.leaderstats.Money.Value + income
end
end
1 Like
You could also eliminate a few lines by doing an inline expression as well, which can be more readable.
local MarketplaceService = game:GetService('MarketplaceService')
local GamePassIncome = 60
local Income = 30
while (true)
do
player.leaderstats.Money.Value =+ mPS:UserOwnsGamePassAsync(plr.UserId, gamepassID) and GamePassIncome or Income
end
2 Likes
I have a code for you here just change Id and Currency
This will only work if your currency is in leaderstats:
local Currency = "Points" --Change to your currency
local Id = 35984459 -- Change to your Id
game.Players.PlayerAdded:Connect(function(player)
wait(15)
local Value = player.leaderstats[Currency].Value
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, Id) then
while Value > -1 do
Value = player.leaderstats[Currency].Value
wait()
if Value < player.leaderstats[Currency].Value then
player.leaderstats[Currency].Value += (player.leaderstats[Currency].Value - Value)
end
end
end
end)
7 Likes
Thanks bro! This helped a lot!
No problem! I like to help when I can.
2 Likes
It Work Also For Me thank you i’ve Been Looking for Solution All Night
1 Like