Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

2 comments

0

Is this a local, or server script?

0

Server Script

1 answer

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

1 comment

0

It didnt work Xyternal

This discussion is preserved as it was. New answers, comments, and votes are closed.