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

How do I make it so that when my map starts, it teleports the players to it?

Asked by 10 years ago
local tools = {"LinkedSword", "Flip"} -- Put the following tools in lighting

-- Put your Match starting script here below
local mapDirectory = game.Lighting.Maps -- This is where your maps are!
local msg = Instance.new("Message")
msg.Parent = game.Lighting
local time = script.Time
-- Script ----------------------------------------------------------------------------------------------------


--Da Loop--
while true do  -- The Loop
local maps = mapDirectory:getChildren()  -- Defins what maps means
--End of Da Loop--



--Without the fail safe we would encounter unhealthy bugs.
-----This is the fail safe-----
if #maps == 0 then   --Counts how many maps there are, if theres 0, removes da script.
    print("Maps not found! Selfremoving...")   --lets you know whats going on
    script:remove()  --removes the script
    return
end                        -- Ends this function
-----Fail Safe Ends-----


---Part that picks da maps-----
local pickedMap = maps[math.random(1, #maps)]  --Defines Pickedmap, as 1-# of maps
local pickedMapClone = pickedMap:clone()          --defines what the picked map clone is
pickedMapClone.Parent = game.Workspace      -- defines the parent of the picked map
pickedMapClone:makeJoints() -- required whenever you insert a model into the world, otherwise it falls apart (From Telamon)
msg.Parent = game.Workspace  --makes a message
msg.Text = "Map Change!"     --makes the text
wait(3)                  --waits 3 seconds
msg.Text = "Picked Map is " ..pickedMapClone.Name.."."   --makes the message of what map
print("Map inserted: " .. pickedMap.Name)      --says when map is made
wait(5)  --waits 5 secs.

msg.Parent = game.Lighting    
wait(time.Value)                    --the value time is refrenced to the time of waitness
pickedMapClone:remove()  --removes the cloned map


end
wait(1) -- change to any number
game.Workspace.tools:Clone(game.Workspace.Players.StarterPack)
0
Please don't just post a free model script and ask us to modify it to your liking for you. PiggyJingles 358 — 10y

1 answer

Log in to vote
0
Answered by
Noculus 25
10 years ago

One method of teleporting the characters is to put invisible blocks in the map and putting them all into a model. (If you want them all to teleport to one place then put the blocks near eachother) Like so...

ChosenMap = game.Workspace.Map --Whatever you call your map..
TeleportModel = ChosenMap.TeleportModel --Whatever you call your teleport thing holder haha
Teleports  = TeleportModel:getChildren()
for i,v in pairs(game.Players:getChildren()) do
v.Character.Torso.Position = Teleports[math.random(1,#Teleports)].Position --Will teleport players to a random one of the teleport blocks
end
0
I don't get it, what if I have more than 1 map? I don't want to name them all "ChosenMap" zachhg03 35 — 10y
Ad

Answer this question