Please help me with my code. ty

–can u guys help me fix this code? it just wont work… theres no error tho, but it just doesnt work…

local MarketPlace = game:GetService(“MarketplaceService”)
local id3 = 1567834438
local Players = game:GetService(“Players”)

Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
MarketPlace.ProcessReceipt = function(receiptInfo)

		if receiptInfo.ProductId == id3 then
			game.ReplicatedStorage.JumpScare:FireAllClients()
		end

			
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end



end)

end)

It’s because you’re defining MarketPlace.ProcessReceipt within a CharacterAdded event. Move it out of the PlayerAdded and CharacterAdded part of the code (below everything basically) and try it then. :slight_smile:

can u fix the code? im bad at coding

local MarketPlace = game:GetService("MarketplaceService")
local id3 = 1567834438
local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(char)
        
    end) 
end)

MarketPlace.ProcessReceipt = function(receiptInfo)
if receiptInfo.ProductId == id3 then
game.ReplicatedStorage.JumpScare:FireAllClients()
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end

1 Like

Might have formatted poorly as I’m on phone, should work though.

It got an error ServerScriptService.Script:1: Expected identifier when parsing expression, got Unicode character U+201c (did you mean ‘"’?)

Yeah it’ll be my phone’s formatting, just edited the code as best I can, try that.

i tried ur code but it got an error

The one above, or something different now?

image

Replace the double quotes in the red underlined parts with your keyboard’s double quotes, should fix it.

image
like this?

That should work yes, if not I’ve changed mine up if you want to give that a whirl.

Did you manage to get it working? :slight_smile:

hey it didnt work
btw this is a jumpscare thingy


btw this is the gui thingy code

image

What error do you get now? Nothing? Ensure you’re firing a PromptProductPurchase correctly in the GUI button you’re binding the functionality too. Also, might be worth breakpointing the code to see if it even reaches there.

nothing. no errors at al/…eeeeeeeeeeeeeee