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

How to make 2x clicks gamepass?

Asked by 2 years ago

Leaderstats:

game.Players.PlayerAdded:Connect(function(player) local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player

local clicks = Instance.new("IntValue")
clicks.Name = "Clicks"
clicks.Value = 0
clicks.Parent = leaderstats

local rebirths = Instance.new("IntValue")
rebirths.Name = "Rebirths"
rebirths.Value = 0
rebirths.Parent = leaderstats

local gems = Instance.new("IntValue")
gems.Name = "Gems"
gems.Value = 0
gems.Parent = leaderstats

end)

Clicking button:

local button = script.Parent local player = game.Players.LocalPlayer local clicks = player:WaitForChild("leaderstats"):WaitForChild("Clicks") local rebirths = player:WaitForChild("leaderstats"):WaitForChild("Rebirths") local Amount = script.Parent.Amount.Value

script.Parent.MouseButton1Click:Connect(function() clicks.Value = clicks.Value + Amount if rebirths.Value > 0 then clicks.Value = clicks.Value + Amount + rebirths.Value end end)

Amount is 1.

1 answer

Log in to vote
0
Answered by 2 years ago

This should make it so if you own a gamepass, the amount given is doubled but it shouldn't be run from a local script. Should be pretty easy to convert to a server script. Basically the same thing but replace game.Players.LocalPlayer with script.Parent.Parent.Parent.Parent or however many you need until you get to the player.

local button = script.Parent
local player = game.Players.LocalPlayer
local clicks = player:WaitForChild("leaderstats"):WaitForChild("Clicks")
local rebirths = player:WaitForChild("leaderstats"):WaitForChild("Rebirths")
local Amount = script.Parent.Amount.Value -- 1

local MarketplaceService = game:GetService('MarketplaceService')
local GAMEPASS_ID = 0 -- id of your gamepass here

script.Parent.MouseButton1Click:Connect(function()
    local givenamount = Amount

    if rebirths.Value > 0 then
        givenamount += rebirths.Value
    end
    -- checks if user owns the gamepass
    if MarketplaceService:UserOwnsGamePassAsync(player.UserId, GAMEPASS_ID) then
        givenamount *= 2
    end

    clicks.Value += givenamount
end)
0
where is ,,player"? komanos212 2 — 2y
0
and where do i put it? Sry for bothering you but i just dont know, i started scripting a week ago. komanos212 2 — 2y
0
plus my leaderstats ain't in local script komanos212 2 — 2y
0
oh u were talking bout this. Ok, where do i put it then if not in local script of my button? *other button that i gave scripts to, cuz i gave scripts for clicking button not gamepass button btw * komanos212 2 — 2y
View all comments (3 more)
0
ok i htink that in normal script, but where is ,,player"? komanos212 2 — 2y
0
player will be different, I can't exactly answer where your 'player' is. go up the frames, to the screen gui, and past the player gui is the player. depending on where you put your script, it will change how many 'parents' you would need to write BulletproofVast 1033 — 2y
0
Tysm komanos212 2 — 2y
Ad

Answer this question