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

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

Asked by
Ap_inity 112
5 years ago
Edited 5 years ago

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)
0
wait no i suppose input is an int value right? youre supposed to do script.Parent.Input.Value radusavin366 617 — 5y
0
Oh Ap_inity 112 — 5y
0
I'm an idiot lol- Ap_inity 112 — 5y
0
I'll update my question, it's doing something different Ap_inity 112 — 5y
View all comments (5 more)
0
What line is it saying it? MythicalShade 420 — 5y
0
3 Ap_inity 112 — 5y
0
You did "PlayerOwnsAsset(game.Players.Ap_inity,assetId)" ? MythicalShade 420 — 5y
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 :) radusavin366 617 — 5y
0
I already did this a while ago, it still errored out. Ap_inity 112 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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) .

0
Alright, I tried that, and it's still printing out the same error. Ap_inity 112 — 5y
0
Same line? MythicalShade 420 — 5y
0
You did "PlayerOwnsAsset(game.Players.Ap_inity,assetId)" ? MythicalShade 420 — 5y
0
I'm not in the game. I want it to check anytime. Ap_inity 112 — 5y
Ad

Answer this question