Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

I'm trying to make a textbox that whenever you enter a model id it puts it in your game?

Asked by 4 years ago
local is = game:GetService("InsertService")
local button = script.Parent
local text = button.Text

is:LoadAsset(text).Parent = workspace

the error is 'Unable to cast string to int64'

0
You forgot to add a function that runs only when user is done typing Leamir 3138 — 4y
0
I think the error means that tonumber is required for this to work, try putting on line 5 JesseSong 3916 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago

LoadAsset requires an integer as input:

local is = game:GetService("InsertService")
local button = script.Parent
local text = tonumber(button.Text)

is:LoadAsset(text).Parent = workspace
0
wont work Configuator 158 — 4y
0
but i gave up on it im making something new Configuator 158 — 4y
0
Ok bomblitz06 94 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

You may want or not want to see this but if you still want to do this,remember that the player cant communicate with the server without a Remote Event! Also remember that the service only instances a model owned by the game creator or ROBLOX

Insert a script in ServerScriptService,and a remote event called "InsertModel" on ReplicatedStorage

game.ReplicatedStorage.InsertModel.OnServerEvent:Connect(function(player,ID)
    local InsService = game:GetService("InsertService")
    local TheID = ID

    InsService:LoadAsset(TheID).Parent = workspace
end)

In StarterGui,Insert A ScreenGui called "InsertGui." There,Insert 2 things more,A textButton called "Button", and a TextBox called "IdType." Insert a LocalScript on the Button:

script.Parent.MouseButton1Click:Connect(function()
    game.ReplicatedStorage.InsertModel:FireServer(script.Parent.Parent.IdType.Text)
end)

I tried it and it works,even without the tonumber(),but if it doesnt work you can add it to the server script tonumber(ID)

Hope it helps! Never give up to reach your beloved dreams!

Answer this question