Basically when the car touches the mine, the mine explodes and the entire car unanchors then flies all over the place.
I’m trying to make the car parts that are laying all over the place disappear after a certain amount of time.
here is my code, this is just a piece of the main code but I want the part to destroy after about 10 seconds or so.
local jeep = game.Workspace:WaitForChild("Jeep")
boom.Hit:Connect(function(part: BasePart, _)
part.Anchored = (part == mine) or false
if hit.Parent:FindFirstChild("Humanoid") then
hit.Parent.Humanoid.Health = 0
end;
task.wait(5)
Jeep:Destroy() -- trying to make the part that got unanchored destroy(not working)
end)
boom.Hit:Connect(function(PartTouched)
part.Anchored = (part == mine) or false
if hit.Parent:FindFirstChild("Humanoid") then
hit.Parent.Humanoid.Health = 0
end;
task.wait(5)
PartTouched:Destroy() -- trying to make the part that got unanchored destroy(not working)
end)
If the jeep model is the first ancestor of all the parts you can just do Hit.Parent:Destroy(), you can also use a loop that goes up a few parents until it reaches Jeep. The last option could be naming the jeeps based on who is in them, and using a player name against it.