This is the code from a script of mine, that loads maps into the workspace, below a small glass box of spectators. Via the chat commands of myself and those in my permissions, maps will be loaded into the workspace, and different commands will be created to fit whatever need.
I am hoping to use one sort of basic structure for every command, since all of the maps are being loaded the same - with exactly the same sizes and limitations.
As of right now, the script loads the map into the workspace, but does not change the name of the model to "Arena Loaded. Teleporting Players..". So, I know that at some point after the cloning and parenting, possibly the CFraming process, it's breaking. I have no idea. I've looked over this code for hours.
It was only yesterday that I got this thing functioning with an 'on' and 'off' ability, simply changing the model name and manipulating a bool value to call on for the rest of the commands.
Thus, if someone can help me debug and possibly shorten or optimize this, I would be very grateful.
if (loweredmsg == "computer, load sf arena" or loweredmsg == "jarvis, load sf arena") and engVal == true then jarvis.Name = "Loading SF Arena.." wait(1) local storedArena = game.ReplicatedStorage.SF_Arena local arenaClone = storedArena:Clone() arenaClone.Parent = game.Workspace.LoadedMaps local sfp = game.Workspace.LoadedMaps.SF_Arena.main_part game.Workspace.LoadedMaps.SF_Arena.PrimaryPart = sfp sfp:SetPrimaryPartCFrame(CFrame.new(0, 0, 0)) game.Workspace.LoadedMaps.SF_Arena:MakeJoints() wait(2) workspace['Loading SF Arena..'].Name = "Arena Loaded. Teleporting Players.." local allsplrs = game.Players:GetPlayers() local zplrs = allsplrs.Character local tps = game.Workspace.SF_Arena:GetChildren() for i = 1, #tps do if tps[i].Name == "tp_brick" then for i, v in pairs(zplrs) do v:MoveTo(tps[i].Position) end end end workspace['Arena Loaded. Teleporting Players..'].Name = "Set-up Successful." wait(2) workspace['Set-up Successful.'].Name = "Jarvis" end