I made a script that lets the player shoot multiple fireballs by pressing f. It worked, so then I want to delete the Fireballs from Workspace after being shot. This is what I have for now, it doesn't work. I also need help with this damaging script. After the bullets are shot it the script won't find them in Workspace.
Player = game.Players.LocalPlayer
Char = Player.Character
Torso = Char.Torso
Mouse = Player:GetMouse()
Attack = false
Mouse.KeyDown:connect(function(key)
local key = key:lower()
if key == "f" and (not Attack) then
Attack = true
for i = 0, 10, 1 do
local Ball = Instance.new("Part")
Ball.Name = "Bullets"
Ball.Parent = game.Workspace
Ball.Shape = "Ball"
Ball.Size = Vector3.new(1,1,1)
Ball.Transparency = .4
Ball.TopSurface = "Smooth"
Ball.BottomSurface = "Smooth"
Ball.BrickColor = BrickColor.new("Really red")
Ball.CFrame = Torso.CFrame * CFrame.new(0,0.5, -5)
Ball.CanCollide = false
local Fire = Instance.new("Fire")
Fire.Parent = Ball
local Bv = Instance.new("BodyVelocity")
Bv.Parent = Ball
Bv.maxForce = Vector3.new(math.huge,math.huge,math.huge)
Bv.velocity = Torso.CFrame.lookVector * 100
wait(.05)
end
wait(3)
game.Workspace.Bullets:Destroy()
Attack = false
end
end)
game.Workspace.Bullets.Touched:connect(function(part)
local h = part.Parent:findFirstChild("Humanoid")
if(h~=nil)then
h.Health = h.Health - 5
end
end)

2 comments
Your question's quite unclear. What's the problem?
It would be a lot easier to just add the new bullet to the game debris