Ad
Log in to vote
0

(cant be solved) I dont understand this error "attempted to call require with invalid arguements"?

Asked by
Nozazxe 83
3 days ago
Edited 2 days ago

Hi, so im making a model inserter for my admin game. For some reason, this script fails to insert the model. Why? insert script in serverscriptservice

game.ReplicatedStorage.Insert.OnServerEvent:Connect(function(id)
    local item = require(id)
    item.Parent = game.Workspace
end)

textbutton local script

script.Parent.MouseButton1Click:Connect(function()
local id = script.Parent.Parent.InsertText.ChangeScript.Change.ChangeRemoteHandler.Text.Value
    game.ReplicatedStorage.Insert:FireServer(id)
end)

Update: I see that insertservice was reccomended, but i want a way to insert stuff made by anyone. is there a way how?

0
the require keyword is used to add module scripts into your code, i think you want to use the InsertService instead, you can see here https://developer.roblox.com/en-us/api-reference/function/InsertService/LoadAsset enzotinman1 22 — 3d
0
It says that it only inserts stuff made by me or roblox. is there a way i can insert stuff made by other people? Nozazxe 83 — 3d
0
as its a security thing i doubt there would be a way to insert any model from the id like you want, its probably for the best tho if people could spawn any model in your game it could contain malicious scripts enzotinman1 22 — 3d
0
im the only one who gets to have it, but since theres no way ill think of something else Nozazxe 83 — 2d

Answer this question