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

How do I make this teleport me to a given position every time a new map is inserted?

Asked by
neoG457 315 Moderation Voter
10 years ago

timer = 10 -- Change this to the amount of seconds waited before a new map is chosen
prefix = "" -- Whatever is in here will come before any messages appeared on screen

if Workspace:findFirstChild("MapsHere") ~= nil then print("Already in") else mo = Instance.new("Model", Workspace) mo.Name = "MapsHere" print("MapsHere has been inserted") end

while wait(5) do txt = prefix .. ": Preparing to insert a new map!" m = Instance.new("Message", Workspace) for i = 1, string.len(txt), 1 do m.Text = string.sub(txt,1,i-1) .. "" .. string.sub(txt,i,i) wait() end end wait(2) m:Remove() maps = game.Lighting.Maps:GetChildren() num = math.random(1, #maps) for i = 1, #maps do if maps[i].Name == maps[num].Name then newmap = maps[i]:Clone() newmap.Parent = Workspace.MapsHere ntxt = prefix .. ": The map " .. newmap.Name .. " has been randomly chosen!" --Map inserted m2 = Instance.new("Message") m2.Parent = Workspace for i = 1, string.len(ntxt),1 do m2.Text = string.sub(ntxt,1,i-1) .. "" .. string.sub(ntxt,i,i) wait() wait(2) m2:Remove()

    while true do 

teleportHere = Vector3.new(-601.52, 750.27, -73.18) -- My failed attempt...

wait(22) local p = game.Players:getChildren() for i=1, #p do p[i].Character.Torso.CFrame = CFrame.new(teleportHere.x, teleportHere.y + ((1-i)*5), teleportHere.z) end end

    end
end
wait(timer)
getmaps = Workspace.MapsHere:GetChildren()
for i = 1, #getmaps do
    getmaps[i]:Remove()
end
m3 = Instance.new("Message")
m3.Parent = Workspace
endtxt = prefix .. ": The current map has been removed, a new map will be picked shortly!"
for i = 1, string.len(endtxt), 1 do
    m3.Text = string.sub(endtxt,1,i-1) .. "" .. string.sub(endtxt,i,i)
    wait()
end
wait(2)
m3:Remove()
    end
1
And how do you make it show the whole damn script in its LUA format? neoG457 315 — 10y
0
wrap the whole thing in a code block Azarth 3141 — 10y
1
k thanks neoG457 315 — 10y

Answer this question