How do I make Bullets Disappear after a few seconds?

**How do I make Bullets Disappear after a few seconds? **

So, I’m currently trying to create a shooting-range and at the moment have created a ray-casting gun that leaves behind a Bullet-hole Decal. But, I don’t know how to script in the bullet holes fading away and I couldn’t find anything on the devforum to help. If anyone could help me out, please do.

Script:

1 Like

After cloning the hole, just simply destroy it.

wait(3) -- time it takes before it goes away
Hole:Destroy()
1 Like

Thanks, sorry, I’m still getting used to scriptting…
(By the way, is there anyway for the bullets to fade away instead of just disappearing?)

You can use TweenService for that, and tween the Transparency of the bullet hole. then after the transparency reaches 1, destroy it.

Here is the API for tweenservice:

2 Likes

Got it, thank you again, I wouldn’t have known about this without you!

1 Like

I believe I know how to tween the transparency of anything form the workspace but it won’t allow me to tween anything in Replicated Storage/It says that the decal doesn’t exist, any solutions?

Hole.Decal or Hole:WaitForChild(“Decal”).

Also, maybe consider using a corutine to bypass the wait since it may stop the code from working/delays the code if it wait()s.

1 Like

Thanks, I was able to finally get the fade effect to work. (With the info from both you and dibbly I finally got it to work, thanks again to both of you)

1 Like

A better way to do this would be using the Debris service roblox made for this reason, this also works without yielding any code.

local Debris = game:GetService(“Debris”)
Debris:AddItem(hole, 3)

3 Likes