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

How do I spawn a map in Workspace by command?

Asked by
Mexual 2
5 years ago

So basically, I'm trying to use Adonis's custom admin command to make a command. This command will be a setmap command, and I want a map in ReplicatedStorage to be placed in Workspace when the command is run.

0
Then set the map"s parent to game.Workspace maxbd 44 — 5y

2 answers

Log in to vote
1
Answered by 5 years ago

To do this,

make the command copy the map to workspace.

local desired_map = nil -- Link this to your map's model
desired_map = desired_map:Clone()
desired_map.Parent = workspace

This should be about it, hope this is clear enough.

0
Not a good answer. You never explained HOW this would be accomplished. DeceptiveCaster 3761 — 5y
0
Oops, forgot to put that I have multiple maps in store, and I want it to spawn the map in when I specify the model's name. Mexual 2 — 5y
Ad
Log in to vote
0
Answered by
VitroxVox 884 Moderation Voter
5 years ago

Hello there, i've edited a quick script for you hope it works, cheers!

function onChatted(msg, recipient, speaker) 

local source = string.lower(speaker.Name)
msg = string.lower(msg)

    if (msg == "map1") then
        changemap("spawn")
    end 

end 


-- Do not edit without experience.
function onPlayerEntered(newPlayer) 
newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end) 
end 

game.Players.ChildAdded:connect(onPlayerEntered)

function changemap(name)
    local getmap = game.Lighting[name]:Clone()
    getmap.Parent = workspace
end

I just added the map change/spawn function the chat command script is not made by me

0
I'll try it, thanks! Mexual 2 — 5y

Answer this question