So i have been wondering how to make a x2 coins gamepass and i need help, can i integrate a x2 coins gamepass with this code?
waittime = 13 -- Time Between each hit
amnt = 10 --how much you get for it
function onTouched(part)
local h = part.Parent:findFirstChild("Humanoid")
if (h~=nil) then
local thisplr = game.Players:findFirstChild(h.Parent.Name)
if (thisplr~=nil) then
local stats = thisplr:findFirstChild("leaderstats")
if (stats~=nil) then
local score = stats:findFirstChild("Coins")
if (score~=nil) then
score.Value = score.Value + amnt
end
end
end
script.Parent.Transparency = 1
script.Parent.CanCollide = false
script.Disabled = true
wait(waittime)
script.Parent.Transparency = 0
script.Parent.CanCollide = true
script.Disabled = false
end
end
script.Parent.Touched:connect(onTouched)

4 comments
Line 19 tho
I would use a debounce instead of doing script.Disabled just in case it causes any problems. Other than that i think it would work fine. Also, I would make a base amount to give the player and then do an if statement to check if the player had the gamepass and if they do, amnt = amnt * 2, this could make your code easier to manage.
You must use a debounce. Disabling the Script will require second-hand reactivation. You can also just set up a Ternary using MarketplaceService's 'UserOwnsGamePassAsync' Boolean to bias amount or amount * 2.
i have no idea how to script, my friend came up with this and he cant help me with the x2 coins game pass thing so i came here for some help