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

I need a script that makes a player earn x2 coins if they have a gamepass. Can somebody please help?

Asked by
vra000 22
2 years ago

So, I tested my hide and seek game with 3 of my alts. And one of them was the seeker, and the other 2 were hiders. I made a x2 Coins gamepass. One of the hiders owned the gamepass, and the other hider doesn't. Here is the line:

for i, contestant in pairs(contestants) do
    contestant.leaderstats.Wins.Value = contestant.leaderstats.Wins.Value + 1
  if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(contestant.UserId, GamepassId) then
 contestant.leaderstats.Coins.Value = contestant.leaderstats.Coins.Value + 40
else
contestant.leaderstats.Coins.Value = contestant.leaderstats.Coins.Value + 20
                    end
            end

But when I test the game, both of the hiders earn 20 coins, when one hider is supposed to earn 40 and the other should earn 20. I could really use some help

0
Is this a local, or server script? Xyternal 247 — 2y
0
Server Script vra000 22 — 2y

1 answer

Log in to vote
0
Answered by
Xyternal 247 Moderation Voter
2 years ago

I think whats wrong is the line

if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(contestant.UserId, GamepassId) then

Try replacing that with the line

local market = game:GetService("MarketPlaceService")
if market:UserOwnsGamePassAsync(contestant.UserId, GamepassId) then
0
It didnt work Xyternal vra000 22 — 2y
Ad

Answer this question