mapactive = nil admins = {"HydroDivinity"} game.Players.PlayerAdded:connect(function(player) for _,v in pairs(admins) do if v == player.Name then player.Chatted:connect(function(msg) if msg:sub(1,5) == "load/" then local map = msg:sub(5,msg:len()) if game.ServerStorage:FindFirstChild(map) then if map ~= nil then map.Parent = game.ServerStorage end game.ServerStorage[map].Parent = game.Workspace map = game.Workspace[map] end end end) end end end)
This is what I have so far. Trying to create a holo-loader
Next time you do a question, please give it atleast a title and a description that explains what you're trying to do and what is wrong.
Either ways, I understood what you meant. You did something that most people do when learning Lua, and you are off with a good start.
You are trying to move the model from ServerStorage to Workspace if I'm not wrong, but you only used .Parent
. This is your problem. You forgot that after using it once, it won't be able to clone anymore because it won't be parented to ServerStorage anymore.
Here's your fix: :Clone()
.
Also, besides this, your only issue was that you failed some logics. If your model is in workspace, it won't check according to your code, which gives your issue.
mapactive = nil admins = {"HydroDivinity"} game.Players.PlayerAdded:connect(function(player) for _,v in pairs(admins) do if v == player.Name then player.Chatted:connect(function(msg) if msg:sub(1,5) == "load/" then local map = msg:sub(5,msg:len()) if game.ServerStorage:FindFirstChild(map) or workspace:FindFirstChild(map) then if map ~= nil then map.Parent = game.ServerStorage end game.ServerStorage[map]:Clone().Parent = game.Workspace map = game.Workspace[map] end end end) end end end)
Hope this helps you!