Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Unable to cast object value!?

Asked by 9 years ago
                        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

Log in to vote
0
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
9 years ago

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.

Ad

Answer this question