local gun = {}
function gun:Shoot(boolean,instance)
local Tracer = script.Tracer:Clone()
Tracer.Parent = workspace.Terrain
Tracer.CFrame = instance.CFrame
Tracer.Velocity = Tracer.CFrame.lookVector.unit * (2000 + instance.Velocity.Magnitude) + Vector3.new(math.random(-4,4), math.random(-4,4), math.random(-4,4))
spawn(function()
Tracer.Touched:Connect(function(part)
if part.Name ~= "Tracer" then
local Explo = Instance.new("Explosion")
Explo.Parent = Tracer
Explo.ExplosionType = Enum.ExplosionType.NoCraters
Explo.Position = Tracer.Position
Explo.BlastRadius = 50
Explo.BlastPressure = 1000
Explo.Visible = false
Tracer.Anchored = true
Tracer.Impact:Play()
for i,v in pairs(Tracer:GetChildren()) do
if v:IsA("ParticleEmitter") then
v.Enabled = true
end
end
wait(.3)
Tracer.Impact.Playing = false
for i,v in pairs(Tracer:GetChildren()) do
if v:IsA("ParticleEmitter") then
v.Enabled = false
end
end
local DamageTime = 1 -- amount of time until next check
local DamageAmount = 10 -- how much damage per check
local Part = Explo -- the part
local function GivePlayersInArea()
local region = Region3.new(Part.CFrame.p-Part.Size/2,Part.CFrame.p+Part.Size/2)
local parts = workspace:FindPartsInRegion3(region,nil,math.huge) -- gives all the part in the region3 i picked math.huge so that means we can have no limit on how many parts can be in the region
local tab = {}
for i,v in pairs(parts) do
if v.Parent then
if game.Players:GetPlayerFromCharacter(v.Parent) and not table.find(tab,v.Parent) then
table.insert(tab,v.Parent) -- puts the players character inside the table
end
end
end
return tab
end
while wait(DamageTime) do
for i ,v in pairs(GivePlayersInArea()) do
v.Humanoid:TakeDamage(DamageAmount) -- takes damage
end
end
wait(3)
Tracer:Destroy()
end
end)
wait(10)
Tracer:Destroy()
end)
end
return gun
So I made this Roblox Jet Script, and I’m trying to make it damage someone but it ain’t seem to work.
Basically Explo is the Explosion Particle Emitter, and if it touches the particle emitter it will damage them, but no damage seems to be dealt.