Need help with Currency event and gamepass

Hello so in my game i wanna do a 10x coin event, the problem is, it wont let me go past x4 and when you rejoin the game, your coins will multiply by 4, and this is the same for my 2x coin gamepass. heres the script.

x2 coin gamepass

game.Players.PlayerAdded:Connect(function(player)
	
	local marketservice = game:GetService("MarketplaceService")
	
	local can = true
	repeat wait() until player:FindFirstChild("leaderstats")
	local leader = player:FindFirstChild("leaderstats")
	if leader then
	repeat wait() until leader:FindFirstChild(script:WaitForChild("Currency").Value)
	local currency = leader:FindFirstChild(script:WaitForChild("Currency").Value)
		if currency then
			local folder = Instance.new("Folder",player)
			folder.Name = "2xGamepass"
			local oldmoney = Instance.new("IntValue",folder)
			oldmoney.Name = "OldMoney"
			oldmoney.Value = currency.Value
			local give2x = Instance.new("IntValue",folder)
			give2x.Name = "Give2x"
			give2x.Value = 0
			
			currency.Changed:Connect(function()
				if marketservice:UserOwnsGamePassAsync(player.UserId, script:WaitForChild("GamepassId").Value) then
				
					
				if can == true then
					can = false
				if currency.Value > oldmoney.Value then
				give2x.Value = currency.Value - oldmoney.Value
			
				currency.Value = currency.Value + give2x.Value
				
				oldmoney.Value = currency.Value
					can = true
					else
						
							oldmoney.Value = currency.Value
							can = true
						
						
				end
					
				end
				else
					oldmoney.Value = currency.Value
				end
			end)
			
		end
	end
end)

coin event script (which also stopped working… idk why…)

game.Players.PlayerAdded:Connect(function(player)
	
	
	local can = true
	repeat wait() until player:FindFirstChild("leaderstats")
	local leader = player:FindFirstChild("leaderstats")
	if leader then
		repeat wait() until leader:FindFirstChild(script:WaitForChild("Currency").Value)
		local currency = leader:FindFirstChild(script:WaitForChild("Currency").Value)
		if currency then
			local folder = Instance.new("Folder",player)
			folder.Name = "CoinEvent"
			local oldmoney = Instance.new("IntValue",folder)
			oldmoney.Name = "OldMoney"
			oldmoney.Value = currency.Value
			local give4x = Instance.new("IntValue",folder)
			give4x.Name = "Give4x"
			give4x.Value = 0
					
					
					if can == true then
						can = false
						if currency.Value > oldmoney.Value then
							give4x.Value = currency.Value - oldmoney.Value
							
							currency.Value = currency.Value + give4x.Value
							
							oldmoney.Value = currency.Value
							can = true
						else
							
							oldmoney.Value = currency.Value
							can = true
							
							
						end
						
					end
				end
			end
			
		end)
	


Can anyone help me make this so i can go past 4x and so your coins dont multiply when you rejoin? if you can thank you!

P.S. i know im just using my coin gamepass for my coin event, but idk what else to use for an event. so if anyone could possibly tell me another way to do it, id be grateful!

oh and, they dont stack…

this script is from icewolffun right?

uuhm, idk lol i do know i got it from a tutorial so probably…

You can just make the sell value x10 and if you have collectible coins or cash on the ground just make it x10

if you have a sell place or something

ive tried, it wont go past x4, and your coins will multiply by 10 if u rejoin… and for some reason it stopped working…

this script has a glitch when u rejoin it will dupe your cash example 2 then when you rejoin it will be 4 the if the player rejoin again it will make 8

ok then do you know a different script that will work?

are you trying to make a gamepass or an event?

both, the gamepass and event just multiplies and event stopped working… i said it already lol

so you want to make your game broke?

you should balance the stats x10 event then x2 gamepass

how? i dont know what u mean…

wait let me read the script wait a minute

game.Players.PlayerAdded:Connect(function(player)

local can = true
repeat wait() until player:FindFirstChild("leaderstats")
local leader = player:FindFirstChild("leaderstats")
if leader then
	repeat wait() until leader:FindFirstChild(script:WaitForChild("Currency").Value)
	local currency = leader:FindFirstChild(script:WaitForChild("Currency").Value)
	if currency then
		local folder = Instance.new("Folder",player)
		folder.Name = "CoinEvent"
		local oldmoney = Instance.new("NumberValue",folder)
		oldmoney.Name = "OldMoney"
		oldmoney.Value = currency.Value
		local give10x = Instance.new("NumberValue",folder)
		give10x.Name = "Give10x"
		give10x.Value = 0
				
				
				if can == true then
					can = false
					if currency.Value > oldmoney.Value then
						give10x.Value = currency.Value - oldmoney.Value
						
						currency.Value = currency.Value + give10x.Value
						
						oldmoney.Value = currency.Value
						can = true
					else
						
						oldmoney.Value = currency.Value
						can = true
						
						
					end
					
				end
			end
		end
		
	end)

try this

still not working, the only thing working is the gamepass…

cause the script that you get from tutorial intended to be a gamepass

yeah, but last time i did it, it was working…

what are game are you working?

also giving me an error.

12:55:33.558 - ServerScriptService.CoinEvent:39: Expected <eof>, got 'end'

oh wait htat typed weird hold up!