I'm having troubles making a coin that gives extra if you own a game pass such as a x2 coin pass. I have tried to edit this, by placing a if you own gamepass if, else thing here:
local id = 6488475 -- your gamepass id
local db = true
script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
if db == true then
db = false
script.Parent.Transparency = 1
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local extra = 2 -- always add 1 extra to this such as if it gives +2 instead of 1, dont put 1, put 2.
player.CharacterAdded:connect(function(char)
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(game.Players[char.Name].UserId, id) then
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + extra
-- etc
I did put a else afterwards and other stuff so. i just didn't put it up here. I'm trying to help my buddy out, and this would be useful to me to. ill put in the game pass id later of course. I have attempted to do this, i'm having troubles with the end not working. Here is the end part, i have done my best but a error still comes up:
end)
end
end)
I assume this is due to a incorrect if and else error or misplaced character or even a missing line that it needs. Please help me find the error, and fix it. Not trying to request.

4 comments
If it doesn't work tell me, also if it drops an error i may need it
It does not work, after editing it, it seems to dropa error related to the if game:GetService etc, so it seems to be messed up there, if u can fix it tell me, otherwise ill try my best
Thanks a bit. I got this to work by changing some lines and connecting it to a true or false value if user owns game pass. but the end and debounce thing helped!
I'm very happy to hear that!