So I've been trying to make a gear gui where the play can put in an ID from the gear catalog to give them the gear they want. The problem is that whenever said player attempts to put in an ID, the output displays 'Unable to cast string to int64', and will not spawn in that item.
wait(1) script.Parent.TextButton.MouseButton1Click:Connect(function() local insertservice = game:GetService("InsertService") local item = insertservice:LoadAsset(script.Parent.TextBox.Text) item.Parent = workspace end)
Any suggestions, tips, or explanations as to why my script isn't working is greatly appreciated!
Hello. The problem is that when getting text from a TextBox, the text is a string, not an Int64. To fix this, use the tonumber()
global.
wait(1) script.Parent.TextButton.MouseButton1Click:Connect(function() local insertservice = game:GetService("InsertService") local item = insertservice:LoadAsset(tonumber(script.Parent.TextBox.Text)) item.Parent = workspace end)