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

Unable to cast string to int64?

13:16:28.837 - Unable to cast string to int64
13:16:28.838 - Stack Begin
13:16:28.838 - Script 'ReplicatedStorage.audioController', Line 153 - function addSong
13:16:28.840 - Script 'Players.benbebop.PlayerGui...Playlist.LocalScript', Line 6 13:16:28.840 - Stack End

Im not quite sure why its giving me this, especially because i have the exact same line of code (local info = MarketplaceService:GetProductInfo(url)) somewhere else in the script, working just fine.

function audio.addSong(url)
	local info = MarketplaceService:GetProductInfo(url)
	local x = script.Song:Clone()
	x.Text = info.Name
	x.Name = info.Name
	x.Id.Value = string.gsub("rbxassetid://", url, "")
	x.Parent = game.Players.LocalPlayer.PlayerGui.Interface.Frame.Music.Songs.Back.ScrollingFrame
	local x = Instance.new("IntValue")
	x.Value = string.gsub("rbxassetid://", url, "")
	x.Parent = script.Value.Value
	listController.Colorise(game.Players.LocalPlayer.PlayerGui.Interface.Frame.Music.Songs.Back.ScrollingFrame)
end

Not full script, function audio.addSong(url) is on line 152

An example of url would be:

rbxassetid://1234567

I tried using string.gsub("rbxassetid://", url, "") to make it an ID but that still doesn't work.

2 comments

0

what line is 152 bro..............

0

nvm

1 answer

The value expects an integer and you gave it a string. That's all that error means.

1 comment

1

just complementing, you can use tonumber() to transform a string in a number

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