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

Why won't this model destroy?

Asked by 9 years ago

Everything works with no errors.

It loops fine.

It's just one thing.

If you look on line 65, you can see I had mentioned

h=Instance.new("Hint")
    h.Parent=game.Workspace
while wait(1) do

    script.StarterMusic:Play()
    script.Hide:Stop()
--variables 

    h.Text=""

    --round starts
    if game.Players.NumPlayers<=0 then
        while game.Players.NumPlayers<=0 do
            wait(1)
    h.Text="Waiting for 2 players..."

        end

    else
            i=5

            while wait(1) and i>0 do
        h.Text=i.." seconds until the round starts!"
        i=i-1
            end


            h.Text="Choosing a random map..."
local maps = game.ServerStorage["Maps"]:GetChildren()

            wait(3)
            players=game.Players:getChildren()
         map = maps[math.random(1, #maps)]
        h.Text="The chosen map is "..map.Name.."!"


--makes the map
mapclone=map:Clone()
mapclone.Parent=game.Workspace
        for i=1,#players do
        wait(3)



wait(3)     
        h.Text="Teleporting players..."

        --makes the map
mapclone=map:Clone()
mapclone.Parent=game.Workspace
        for i=1,#players do
            local Tel1 = mapclone:findFirstChild("Spawn")
            players[i].Character.Humanoid.WalkSpeed=0
players[i].Character.Torso.CFrame=CFrame.new(Tel1.Position+Vector3.new(0,3,0))
end
wait(3)
h.Text="All players have 1 minute to escape. Go!"
wait(2)
        for i=1,#players do

            players[i].Character.Humanoid.WalkSpeed=16

end
script.StarterMusic:Stop()
script.Hide:Play()
i=10

while wait(1) and i>0 do
    h.Text="You have "..i.." seconds left!"
    i=i-1
end
mapclone:Destroy()
for i=1,#players do
    if players[i].won.Value==1 then
        players[i].leaderstats.Won.Value=players[i].leaderstats.Won.Value+1
    end
end

        end
    end
end

Help and upvotes are appreciated!

     ds

1 answer

Log in to vote
0
Answered by
wackem 50
9 years ago

This should work, if it does not, you have conflicting scripts I suppose.

local v = mapclone:GetChildren()

v:Destroy()
0
Thanks, but I found the problem. I cloned the model twice. ChemicalHex 979 — 9y
Ad

Answer this question