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

Inserting a Model with a id in a text box?

So I made a gui that should insert a model (That I own which is also in my game) and i was trying to make the textbox replicated as the model id that will be inserted (the model would be one that I own or a free model) here's the script:

local id = script.Parent.TextBox.Text
script.Parent.TextButton.MouseButton1Click:Connect(function()
	    local model = game:GetService("InsertService"):LoadAsset(id)
		 model.Parent = workspace
end)

hopefully somebody could help!

1 comment

0

It returns with an error "Unable to cast string to int64"

1 answer

You were giving it a string when it needed an integer, the tonumber turns it into a string if the string is a valid number else its nil,

local model = game:GetService("InsertService"):LoadAsset(tonumber(id))

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