"unable to cast value to object"... Developer Products

I am creating a script that checks the status of a Dev product. I am getting this error “Unable to cast value to object”.

I have been trying to figure this out for a while, but cannot find a solution… What am I doing wrong?

What line is the error at? Is it from the print one?

line 21 apparently…

3 0 c h a r s

I obviously can’t see the lines from that script?

oh wait thats right aha. here:

1 Like

Did the print on the 15th line print out?

yes it does.
I changed it to just print “done” for testing purposes, and it prints that. Then it does the “unable to cast value to object” error still.

Got you,

So it’s obviously inside the remote event part.

Mind also showing the client side? [when you’re calling that FireClient event]
The issue might be there

nothing is coming from the client side.

Still. You are firing a remote to the client, where are you calling that remote on the client?

The issue might be there.

The issue comes from the server script because thats where you fire the remote to the client. And apparently the issue is there

figured it out:

when you check if the product was purchased or not, it only returns the players UserID, not their actual player reference. So when I was going to reference the player to FireClient(), it was referencing their UserID, and not actual player.

1 Like