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

I want to make a part that destroys a model (Moving Car Model) *Doesn't Work, help please* [??]

script.Parent.Touched:Connect(function(hit)
	if hit.Parent.Name == "RedRectangleVehicle" then
		local children = hit.Parent:GetChildren()
       children:Destroy
	end
end)



I don't know why it isn't working. Please help. -rayhansatria

2 answers

✓ Accepted answer

You could either delete the whole model like this:

script.Parent.Touched:Connect(function(hit)
    if hit.Parent.Name == "RedRectangleVehicle" then
        hit.Parent:Destroy()
    end
end)

Or you could try clearing its children like this:

script.Parent.Touched:Connect(function(hit)
    if hit.Parent.Name == "RedRectangleVehicle" then
        hit.Parent:ClearAllChildren()
    end
end)

4 comments

0

Doesn't work, the vehicle just go through the block

0

can you post the explorer window

0

Oh, my children are just union, nevermind. Works! Thanks

0

please accept it as an answer if it works :)

Try this..

function onTouch(hit)
    if hit:IsA("Model") then
        if hit.Name == "RedRectangleVehicle" then
             hit.Parent:ClearAllChildren()
          end
     end
end

script.Parent.Touched:Connect(onTouch)

Try this and tell me if it worked!

1 comment

0

You cannot touch models

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