Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why won't the models get deleted?

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

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

1 comment

0

im looking for models

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.