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)
I edited your code a little bit and this should work, all you need to do is get your gamepass id and change it to 'GamePassId'
local MPS = game:GetService("MarketplaceService") local Players = game:GetService("Players") local GamePassId = 15200883 -- your gamepass id here local RespawnTime = 13 local Reward = 10 local Collected = false function Touch(object) if object.Parent:FindFirstChild("Humanoid") then if Players:GetPlayerFromCharacter(object.Parent) then local Player = Players:GetPlayerFromCharacter(object.Parent) local leaderstats = Player:FindFirstChild("leaderstats") local Coins = leaderstats:FindFirstChild("Coins") if leaderstats ~= nil and Coins ~= nil then if not Collected then Collected = true if not MPS:UserOwnsGamePassAsync(Player.UserId, GamePassId) then Coins.Value += Reward else Coins.Value += Reward *2 end script.Parent.Transparency = 1 script.Parent.CanCollide = false wait(RespawnTime) script.Parent.Transparency = 0 script.Parent.CanCollide = true Collected = false end end end end end script.Parent.Touched:connect(Touch)