Hello, I'm making a holo. I know how do to chat commands, but I am having trouble with the command that takes the maps. The Script below does not work because not all of the maps are present.
elseif message == "!end" then local End = game.Workspace.Pitgrounds:remove() local End2 = game.Workspace.Bricktops:remove()
For example, if I did not load Pitgrounds the error would be, "Bricktops is not a valid member of Workspace"
Please Help
Try using a for loop to check if the thing in the workspace is the name of any maps you have. Also, use destroy instead of remove. Remove is laggy because it doesn't actually delete the object.
elseif message == "!end" then for i,v in pairs (game.Workspace:GetChildren()) do if v.name = "Map1name" or "Map2name" or "Map3nameyougettheidea" then v:Destroy()
This only works if the map is a model and you list all the names of the maps that can be loaded in line 3.
If it works don't forget to upvote and accept the answer!