Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I spawn a map in Workspace by command?

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.

1 comment

0

Then set the map"s parent to game.Workspace

2 answers

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.

2 comments

0

Not a good answer. You never explained HOW this would be accomplished.

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.

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

1 comment

0

I'll try it, thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.