Why can I not destroy a map in a game?
Asked by
6 years ago Edited 6 years ago
So I am making a game and I have a maps that are randomly picked and after the round I am trying to destroy them with :Destroy() but it wont work. Can someone help me with this? Everything else works except this.
Code
001 | Maps = { "Campout" , "Pyramid" , "Temple" } |
009 | c = game.Players:GetChildren() |
011 | c [ i ] .PlayerGui.InformationGui.Frame.TextLabel.Text = "" .. update |
019 | if game.Players.NumPlayers > = numofplayers then |
021 | for i = 1 , intermission do |
023 | m( "The next flood will strike in: " .. intermission -i) |
027 | pl = game.Players:GetChildren() |
030 | pl [ i ] .Playing.Value = true |
034 | rndum = math.random(#Maps) |
037 | game.Lighting [ cmap ] :Clone().Parent = game.Workspace |
041 | m( "Picking a map .." ) |
043 | m( "Picking a map ..." ) |
045 | m( "The chosen map is " .. cmap) |
048 | plpl = game.Players:GetChildren() |
051 | if plpl [ i ] .Playing.Value = = true then |
052 | cspawn = game.Workspace.Part |
053 | target = CFrame.new(cspawn.Position) |
054 | for i, player in ipairs (game.Players:GetChildren()) do |
055 | if player.Character and player.Character:FindFirstChild( "HumanoidRootPart" ) then |
056 | player.Character.HumanoidRootPart.CFrame = target + Vector 3. new( 0 , i * 5 , 0 ) |
065 | for i = 1 , timebeforeround do |
066 | m( "The Flood is coming in " .. timebeforeround - i) |
071 | local platform = workspace.Place.Platform |
072 | platform.Material = "Foil" |
073 | platform.Size = Vector 3. new( 500 , 100 , 300 ) |
074 | local storage = game:GetService( "Lighting" ) |
075 | local part = storage [ "Kill" ] :clone() |
076 | part.Parent = platform |
081 | getlpa = game.Players:GetChildren() |
085 | if getlpa [ i ] .Playing.Value = = true then |
086 | getlpa [ i ] .Character.Humanoid.WalkSpeed = 16 |
087 | lp = getlpa [ i ] :GetChildren() |
099 | m( "The Flood ends in: " .. gamewait - i) |
104 | getlpas = game.Players:GetChildren() |
106 | m( "The Flood is gone." ) |
107 | local platform = workspace.Place.Platform |
108 | platform.Material = "Cobblestone" |
109 | platform.Size = Vector 3. new( 500 , 2 , 300 ) |
110 | platform.Kill:Destroy() |
113 | cmap.Parent = workspace |
116 | <pre class = "brush: lua" ></pre> |