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

How to make 2x clicks gamepass?

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

✓ Accepted answer

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)

7 comments

0

where is ,,player"?

0

and where do i put it? Sry for bothering you but i just dont know, i started scripting a week ago.

0

plus my leaderstats ain't in local script

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 *

0

ok i htink that in normal script, but where is ,,player"?

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

0

Tysm

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