✓ Accepted answer
The most likely reason why it doesn't work is, it only checks the TextBox once
You can transfer the line local Music = game:GetService("MarketplaceService"):GetProductInfo(script.Parent.Parent.IDhere.Text) just underneath script.Parent.MouseButton1Click:Connect(function()
This will make it, so the script will check the TextBox every time that the TextButton is clicked, this should also apply to your ID variable, as it only checks it once
Unable to cast string to int64
This means that the script attempted to give something a string, but it has expected a int64, which is a number that can go negative and positive, and up to the number
2 ^ 64 - 1
To fix this you'd want a number input, not a string input, meaning if a sound id is 123, you'd want to put in the number 123, not the string "123" or the string "rbxassetid://123", since the most likely thing you are experiencing is the string "123", you'd want to put a tonumber to transform a string to a number, therefore your code shall be:
script.Parent.MouseButton1Click:Connect(function()
local Music = game:GetService("MarketplaceService"):GetProductInfo(tonumber(script.Parent.Parent.IDhere.Text))
local ID = script.Parent.Parent.IDhere
if string.len(ID.Text) > 0 then
script.Parent.Text = '...'
wait(1)
script.Parent.Text = 'Playing: ' ..Music
else
script.Parent.Text = 'Error: No ID Found'
end
end)
6 comments
What line is that error on? I see two possible places that might be erroring.
Line 1
Do you have a string value.
i dont believe i do? do you mean in the TextBox Where The ID Goes?
Yes
then yes i do.