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

Why won't the models get deleted?

Asked by
Xyternal 247 Moderation Voter
3 years ago

Following yesterday, my script successfully respawns the player, but now my model isn't get deleted.

game.Players.PlayerAdded:Connect(function(player)

    local admin = game.ReplicatedStorage.Status


    while true do
        if admin.Value == "Intermission" then

            player.RespawnLocation = game.Workspace.Lobby
            local trees = workspace:FindFirstChild("car")

            local treeChild = trees:GetChildren()

            for I,v in pairs(treeChild) do 
                if v.Name == "car" then 
                    v:Destroy() 
                end
            end
        else

            player.RespawnLocation = game.Workspace.Main
        end
        wait(0.5)
    end


end)

What is my error?

2 answers

Log in to vote
0
Answered by 3 years ago

are you looking for a child inside of car called 'car', or are you looking for the car itself?

0
im looking for models Xyternal 247 — 3y
Ad
Log in to vote
0
Answered by
Xyternal 247 Moderation Voter
3 years ago
game.Players.PlayerAdded:Connect(function(player)

    local admin = game.ReplicatedStorage.Status


    while true do
        if admin.Value == "Intermission" then

            player.RespawnLocation = game.Workspace.Lobby
           for i, v in pairs(workspace:GetChildren()) do
    if v.Name = "car" then
    v:Destroy()
    end
    end
        else

            player.RespawnLocation = game.Workspace.Main
        end
        wait(0.5)
    end


end)

Answer this question