How would I make my rocket model dissapear after some time?

I’m making a game and I have a rocket model that I want to destroy after a certain amount of time

local rocket = game.ReplicatedStorage.Rocket

local button = game.Workspace.VipButtonRocket

local cannon = game.ReplicatedStorage.RocketShooter

local RCopy = rocket:Clone()

local CCopy = cannon:Clone()

button.Touched:Connect(function()

local happyhome = game.ReplicatedStorage.HappyHome:Clone()

RCopy.Anchored = true

button.Parent = game.Lighting

CCopy.Parent = game.Workspace

RCopy.Parent = game.Workspace

wait(13)

end)

local distance = 224

while wait(.001) do

RCopy.CFrame = RCopy.CFrame + Vector3.new(0, 0, -1)

end

This script moves the rocket and respawns the model’s I’m not done the script but right now I just need it to destroy the rocket after 6 seconds, Thanks.

Maybe add like a destroy() thing? I’m not the greatest on coding

1 Like

I tried that but I don’t know how to make it destroy after some time because it is in a while loop I’m also not the greatest developer lol.

1 Like

What about making it unanchor and it all falls out into the void?

1 Like

You can use Debris. It’s a service that will destroy an instance after x seconds. It works by using :AddItem() and takes the part to destroy and how long until it destroys it.

local Debris = game:GetService("Debris")

Debris:AddItem(PartToDestroy, TimeUntilDestroy)

So you could try:

local Debris = game:GetService("Debris")

Debris:AddItem(RCopy, 5) -- Change 5 for however long you want the rocket to last
2 Likes