Want to stay connected to the Scripting Helpers community and get real-time help? Join the Scripting Helpers Discord Server!
Ad
Log in to vote
0

Unable to cast string to int64?

Asked by 3 months ago
Edited 3 months 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 2232 — 3mo
0
oof I meant script.Parent.Text = asset.Name but i still get the error DaWarTekWizard 141 — 3mo

1 answer

Log in to vote
0
Answered by 3 months ago
Edited 3 months 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 15 — 3mo
0
TYSM, enjoy your first rep xD DaWarTekWizard 141 — 3mo
0
Actually I am getting "Argument 1 missing or nil" now. DaWarTekWizard 141 — 3mo
0
what line? ThisIsAnAccount255 15 — 3mo
0
I figured that out, thanks anyways. DaWarTekWizard 141 — 3mo
Ad

Answer this question