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

How to Run/Load maps?

Asked by 9 years ago

Hello fellow Robloxians, I was wondering how do you run or load maps? I have a basketball group, and I was wondering how to run or load maps without a time limit. Here's the script: (My friend said you needed Court Scripts)

-- Store all your maps in Lighting.

current_map = nil
names = {"EnergyBrickz"}    -- who has permission to use load/

game.Players.PlayerAdded:connect(function(player)
    for i, v in pairs(names) do
        if v == player.Name then 
            player.Chatted:connect(function(chatmsg)
                if chatmsg:sub(1,4) == "load/" then    --if you want to change the command rename load/ (like: run/..)
                    local map = chatmsg:sub(5, chatmsg:len())
                    if game.Lighting:FindFirstChild(map) then
                        if current_map ~= nil then
                            current_map.Parent = game.Lighting
                        end
                        game.Lighting[map].Parent = game.Workspace
                        current_map = game.Workspace[map]
                    end
                end
            end)
        end
    end
end)

Answer this question