I was just wanting to know if this script would work or not.
ball = script.Parent local invelocity = ball.Velocity wait() function onTouched(hit) local human = hit.Parent:findFirstChild("Humanoid") if (human ~= nil) then human.Health = human.Health - 25 --How much damage the brick does when touched. (100=death when health is normal) end end script.Parent.Touched:connect(onTouched) connection = script.Parent.Touched:connect(onTouched) wait(0.5) ball.Parent = nil
That script would work, although you should probably remove the bullet after it hits someone instead of after 0.5 seconds. That way it won't if it hasn't hit anyone yet. You can also add a timeout so if it never hits anyone it gets removed too, but 0.5 seconds seems too short.
I'm not sure why you made the connection a variable. The only use of that would be if you wanted to disconnect the event later in the script.
Also you should use :Destroy() instead of parenting things to nil to get rid of them.
This would be a more efficient script:
ball = script.Parent local invelocity = ball.Velocity wait() Game:GetService("Debris"):AddItem(ball, 10) -- you could just add wait(10) ball:Destroy() at the end of the script but I think this is fancier :3 function onTouched(hit) local human = hit.Parent:findFirstChild("Humanoid") if (human ~= nil) then human.Health = human.Health - 25 --How much damage the brick does when touched. (100=death when health is normal) ball:Destroy() end end script.Parent.Touched:connect(onTouched) connection = script.Parent.Touched:connect(onTouched)