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

01local clicks = Instance.new("IntValue")
02clicks.Name = "Clicks"
03clicks.Value = 0
04clicks.Parent = leaderstats
05 
06local rebirths = Instance.new("IntValue")
07rebirths.Name = "Rebirths"
08rebirths.Value = 0
09rebirths.Parent = leaderstats
10 
11local gems = Instance.new("IntValue")
12gems.Name = "Gems"
13gems.Value = 0
14gems.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.

01local button = script.Parent
02local player = game.Players.LocalPlayer
03local clicks = player:WaitForChild("leaderstats"):WaitForChild("Clicks")
04local rebirths = player:WaitForChild("leaderstats"):WaitForChild("Rebirths")
05local Amount = script.Parent.Amount.Value -- 1
06 
07local MarketplaceService = game:GetService('MarketplaceService')
08local GAMEPASS_ID = 0 -- id of your gamepass here
09 
10script.Parent.MouseButton1Click:Connect(function()
11    local givenamount = Amount
12 
13    if rebirths.Value > 0 then
14        givenamount += rebirths.Value
15    end
View all 22 lines...
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