im trying to make a map changer that changes a map then teleports a player to it. i made this code but its broken
local time_between_each_map = 43 local time = 1 local w = game.Workspace:GetChildren() for i = 1, #w do if w[i].ClassName == "Message" or w[i].ClassName == "Hint" then w[i]:Remove() end end while true do local h = Instance.new("Hint") local m = Instance.new("Message") local maps = game.Lighting.Big:GetChildren() h.Parent = workspace repeat h.Text = time.. " seconds left before new map." time = time - 1 wait(1) until time == 0 local w = game.Workspace:GetChildren() for i = 1, #w do if game.Lighting.Big:findFirstChild(w[i].Name) then w[i]:Remove() end end h:Remove() m.Parent = workspace local pm = maps[math.random(1,#maps)] local map = pm:Clone() map.Parent = workspace map:makeJoints() m.Text = "New Stage: " ..map.Name time = time_between_each_map wait(1) m:Remove() wait(0.2) pos = -127.708, 35.319, 159.171 WaitTime = 46 dft = {} function GetPlayers() local c = game.Players:GetChildren() for i = 1, #c do table.insert(dft, c[i].Name) end end function Randomize() GetPlayers() local d = math.random(1, #dft) local s = d local m = Instance.new("Message", game.Workspace) m.Text = "The random player is ... "..dft[s].."!" wait(2.1) m:Remove() local rndm = game.Players:FindFirstChild(dft[s]) if (rndm ~= nil) then local Player = rndm.Character Player:MoveTo(Vector3.new(127.708, 35.319, 159.171)) end end while true do wait(46) Randomize() end
whats wrong with it?
Closed as Not Constructive by User#19524
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?