Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Unable to cast object value!?

                        OUTPUT

13:00:14.546 - Unable to cast value to Object 13:00:14.546 - Script 'Players.brickgame191.PlayerGui.Script', Line 3 13:00:14.546 - Stack End

heres the script :

local G1 = (IDhidden)

if game:GetService("MarketplaceService"):PlayerOwnsAsset(script.Parent.Parent.userId, G1) then
script.Parent:WaitForChild("SreenGui").GShop.G1.Check.Visible = true
end

Whats the problem? D:

1 answer

✓ Accepted answer

PlayerOwnsAsset takes the Player, not their userId, as the first argument. Simply remove the .userId bit from line 3.

What this error means is that you are attempting to take some data (I.e. a Number or a String) and use it in place of a ROBLOX Object (I.e. a Player or a Part), which doesn't work.

This discussion is preserved as it was. New answers, comments, and votes are closed.