I am scripting a module that converts RetroStudio studio selections to Roblox objects, however, whenever I try to execute testing module code without running the game in studio, this error appears:
Error found! Error: ServerScriptService.MainModule:34: invalid argument #3 (Instance expected, got string)
Despite the fact that none of my functions intake 3 parameters, it still throws this issue anyway. Here’s the module code:
local httpService = game:GetService("HttpService")
local function findInstance(path)
local split = path:split(".")
if #split == 0 then return end
local constructed = split[1]:lower() == "workspace" and workspace or game
for i=2, #split do
constructed = constructed[split[i]]
end
return constructed
end
assert(httpService.HttpEnabled, "HttpService must be enabled via the code: \"game.HttpService.HttpEnabled = true\" in the command line")
return function(json)
local startTime = os.clock()
json = httpService:JSONDecode(json)
local success, fail = pcall(function()
for cn, props in pairs(json) do
local obj = Instance.new(cn)
for n, v in pairs(props) do
obj[n] = n == "Parent" and findInstance(v) or v
end
end
end)
if not success then warn("Error found! Error:", fail) end
local endTime = os.clock()
print("Exported in:", endTime - startTime)
end
Here’s my command-line code, for testing:
local tab = {Part = {Name = "Billy", Parent = "Workspace"}} local test=game.HttpService:JSONEncode(tab) require(game.ServerScriptService.MainModule)(test)
TLDR; When I test my module with command line code without pressing F8, it just breaks.
Edit: Literally forgot to restart studio. Can’t they just listen for script source changes in the command line?!