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

Unable to cast string to int64?

Asked by 6 years ago
Edited 6 years ago

I have this script for an ife and I keep getting this error:

Unable to cast string to int64

Any help?

while script.Parent.Parent.Visible == true do
    local asset = game:GetService("MarketplaceService"):GetProductInfo(script.Parent.Parent.Song.SoundId)
    script.Parent.Text = asset.Name
    wait(.1)
end
0
GetProductInfo only takes the numbers from the ID of the product, not the whole string assetID itself. mattscy 3725 — 6y
0
oof I meant script.Parent.Text = asset.Name but i still get the error DaWarTekWizard 169 — 6y

1 answer

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

getproductinfo needs to have a number input. infront of your number is "rbxassetid://". I havent tested it but i think it will work )

while script.Parent.Parent.Visible == true do
    local asset = game:GetService("MarketplaceService"):GetProductInfo(tonumber(script.Parent.Parent.Song.SoundId:sub(14)))
    script.Parent.Text = asset.Name
    wait(.1)
end

edit:

this code i tested and it worked:

local sid = "rbxassetid://685388224"
while script.Parent.Value.Value == true do
    local asset = game:GetService("MarketplaceService"):GetProductInfo(tonumber(sid:sub(14)))
    print(asset.Name)
wait(.1)
end
0
since line 2 is long i recommend using "view source" ThisIsAnAccount255 143 — 6y
0
TYSM, enjoy your first rep xD DaWarTekWizard 169 — 6y
0
Actually I am getting "Argument 1 missing or nil" now. DaWarTekWizard 169 — 6y
0
what line? ThisIsAnAccount255 143 — 6y
0
I figured that out, thanks anyways. DaWarTekWizard 169 — 6y
Ad

Answer this question