ServerScriptService.NoobPass:19: Expected identifier when parsing expression, got ')'

Players.PlayerAdded:Connect(function(player)
	if skinWorks.Value == true then
		local success, message = pcall(function()
			OwnsNoob = MarketPlaceService:UserOwnsGamePassAsync(Player.userId, NoobPassID)
		end)
		
		if OwnsNoob then
			print("This dude owns the noob")
			
			NoobEvent:FireClient(Player)		
		end
	end)
	
	local function OnNoobPurchased(Player, purchasedPassID, purchaseSuccess)
		if purchaseSuccess == true and purchasedPassID == NoobPassID then
			print("This dude bought the noob")
			
			NoobEvent:FireClient(Player)
		end
	end	
end

The code that is shown below gives an error on the final end, and it confuses me a lot.
i also can’t delete the ) because then it looks for an ending ) and breaks.

Players.PlayerAdded:Connect(function(player)
	if skinWorks.Value == true then
		local success, message = pcall(function()
			OwnsNoob = MarketPlaceService:UserOwnsGamePassAsync(Player.userId, NoobPassID)
		end)
		
		if OwnsNoob then
			print("This dude owns the noob")
			
			NoobEvent:FireClient(Player)		
		end
	end)

Let me know if more info is necessary.

1 Like
Players.PlayerAdded:Connect(function(player)
	if skinWorks.Value == true then
		local success, message = pcall(function()
			OwnsNoob = MarketPlaceService:UserOwnsGamePassAsync(Player.userId, NoobPassID)
		end)
		
		if OwnsNoob then
			print("This dude owns the noob")
			
			NoobEvent:FireClient(Player)		
		end
	end
end)
1 Like

I’ll try that and see if it works.
I do have a feeling that it wont work due to the fact that i want the if to cover the whole script, as seen in my top script. I will get the full script to see if it helps clear anything up, sorry for being vague.

wait, hold up, testing something.

In your bottom script, there was an end missing. Is that the problem?

1 Like

i think i just found a better fix, if i do i will leave the script in this thread, and explain what it does, is that ok?

1 Like