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

Gamepass Only AutoClicker Help?

Asked by 3 years ago

while true do wait(0.1) for _,plr in pairs(game.Players:GetChildren()) do local stats = plr:FindFirstChild('leaderstats') if stats then stats.Money.Value = stats.Money.Value + 1 end end end

This is my script for giving 1 money per second, (for autoclicker gamepass)

but I cant figure out how to make it so it only does on gamepass AND because I am doing a clickers game, it doesnt just give you 1 money per second, it gives you how much your money per click gives.

can someone teach me how to make it so only if the player has gamepass? or if you can teach me how I can make the second one.

thanks

1 answer

Log in to vote
0
Answered by
CodeWon 181
3 years ago
Edited 3 years ago

You can do this using market place service:

First of all, you need to create your gamepass and you need to make a variable for the service. Get the gamepass id and put it here:

local gamepassId = 0 --id

local MarketplaceService = game:GetService("MarketplaceService")

Then you need to make a prompt to buy it. For example a button. Put a local script inside of a button, like this:

script.Parent.MouseButton1Click:Connect(function(player)
    MarketplaceService:PromptGamePassPurchase(player, gamepassId)
end)

You also need to make that gamepass do something. Create a new script in server script service and create the variables from the top once again. Enter in this code:

game.Players.PlayerAdded:Connect(function(player)
    if MarketplaceSerivice:UserOwnsGamePassAsync(player.UserId, gamepassId) then
        --Do stuff if the player owns the gamepass
    end
end)

I'm not the best at scripting but I really hope this helps!

Ad

Answer this question