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

Checks if I own a model, but it's unable to cast to int64? [EDIT]

This script should be working, I did everything as intended, but as soon as I tested it, it broke; it now says that it's Unable to cast value to Object

Here's where it errors out:

script.Parent.Process.MouseButton1Click:Connect(function()
	local id = script.Parent.Input.Text
	if game:GetService("MarketplaceService"):PlayerOwnsAsset(117099978, id) then
		local insert = game:GetService("InsertService"):LoadAsset(id)

9 comments

0

wait no i suppose input is an int value right? youre supposed to do script.Parent.Input.Value

0

Oh

0

I'm an idiot lol-

0

I'll update my question, it's doing something different

0

What line is it saying it?

0

3

0

You did "PlayerOwnsAsset(game.Players.Ap_inity,assetId)" ?

0

yeah, ^ the 1st argument should be the instance of the player, not the user id. please put [solved] in the title if it works :)

0

I already did this a while ago, it still errored out.

1 answer

You use PlayerOwnsAsset() by doing PlayerOwnsAsset(player,assetId). You are using the player's UserId as the first argument, instead of the actual player.

What this error means though is that you are taking some type of data (UserId) and trying to use it in place of an Object (a player) .

4 comments

0

Alright, I tried that, and it's still printing out the same error.

0

Same line?

0

You did "PlayerOwnsAsset(game.Players.Ap_inity,assetId)" ?

0

I'm not in the game. I want it to check anytime.

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