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)

3 Likes

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:

1 Like

can u fix the code? im bad at coding

1 Like
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

3 Likes

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

1 Like

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

1 Like

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

1 Like

i tried ur code but it got an error

1 Like

The one above, or something different now?

1 Like

image

1 Like

1 Like

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

1 Like

image
like this?

1 Like

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

1 Like

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