Unknown error in code?

Hey there, I was moving stuff from a test place to an actual game then saw the code doesn’t work as expected in the game but it works perfectly in the test place.

Game:

Test place:

  • i’ve created new developer products and game passes and replaced the id’s in the code
  • i’ve enabled api services and third party sales

it’s basically a shop where you can buy currency or coils, but in the game it doesn’t give you any of that if bought, could the red lines under the code? Any help is appreciated, thank you.

Yeah no that’s weird, I’ll try to think of a solution

1 Like

Could it be the weird indentation? I noticed in the original the line numbers are fine, but in the new one it sometimes skips them (and the errors only appear after them). See if you can fix the lines.

1 Like

There is most likely a hidden whitespace in your script (U+2028). This specific character acts like a newline but isn’t interpreted as one in the editor/compiler. Your best bet is to copy the working one into the broken one.

This fixed a problem, i’m able to buy the speed coil, but get an error when trying to buy anything else such as the gravity coil.

In your test place, you didn’t have whitespace between the dictionary values
image
Hence the lines on the right are in order, 12,13,14,15 etc.
image
In your new place, there are whitespaces, unrecognized by the script editor.
Try removing the lines and adding them back in.

EDIT: My bad, didn’t see the other replies above

1 Like

It could be that you’re indexing the cash passes by putting the ids in strings. Try making them plain numbers. If that doesn’t work, could you show me the Developer Product handler you have?

Dev product handler:

this remained unchanged in the test place btw.

Where do you prompt the purchase? That’s most likely where the issue is.

1 Like

I prompt it in the shopUI:

You somehow managed to place a line separator character somewhere. Was this code written in some kind of an online IDE and then copied over to Roblox maybe? Not all white space unicode characters are treated the same in Lua.

Search U+2028 in google, copy the character from some unicode lookup site and paste it in Find. Then replace it with spaces, tabs or new lines.

No I did’t use an IDE, I copied the script off a test place i made, the spacing problem is good now.

Hmm, I’m not sure exactly what’s going wrong here. I tried prompting purchases with the same IDs as you, but it worked fine. Is this a group game?

1 Like

it is indeed a group game, the test place is too.

Alright, make sure the Developer Products are owned by the group (because they might be owned by you and 3rd party purchases would probably be disabled).

The dev products are in the place, does this mean they are owned by the group?? let me show you:

ignore the ones crossed out.

Yeah, that’s not the issue then. I’d be nice if purchase errors gave more information. Are you returning Enum.ProductPurchaseDecision.PurchaseGranted in your ProcessReciept function?

Yes, it does:

Darn. I got no idea then, maybe try again later like it says, but I’d recommend searching around Google.

1 Like

Nah you’re good, I fixed it, thanks for all the support though, it helped, highly appreciated.