This script is inside a turret. This is the ammo script. I don't care about the damage player stuff because i won't be using this on a player so you can take that out.
ball = script.Parent
damage = 50
function onTouched(hit)
local humanoid = hit.Parent:findFirstChild("Humanoid")
if humanoid ~= nil then
humanoid:TakeDamage(damage)
local explosion = Instance.new("Explosion", ball)
explosion.Position = ball.Position
ball:Remove()
end
end
connection = ball.Touched:connect(onTouched)
wait(5)
ball.Parent = nil

3 comments
Didn't work
Workspace is removed after 5 seconds.
didn't work