Player = game.Players.LocalPlayer
local Mouse = game.Players.LocalPlayer:GetMouse()
Ammo = 1
AmmoE = 1
AmmoD = 1
game:GetService("UserInputService").InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.F and Ammo>0 then
local x = Instance.new("Part", workspace)
x.Shape = "Ball"
x.BrickColor = BrickColor.new("Deep orange")
x.Transparency = 0.3
x.TopSurface = "Smooth"
x.BottomSurface = "Smooth"
x.CanCollide = false
x.Parent = workspace
x.CFrame = Player.Character.HumanoidRootPart.CFrame*CFrame.new(0,0,-6)
local v = Instance.new("BodyVelocity")
v.Parent = x
v.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
v.Velocity = (x.Position - Mouse.hit.p).unit*-100
Ammo = Ammo - 1
if x.Touched:Connect(function()
if AmmoE == 1 then
x.Transparency = 1
local Explosion = Instance.new("Part", workspace)
Explosion.Shape = "Ball"
Explosion.BrickColor = BrickColor.new("Deep orange")
Explosion.TopSurface = "Smooth"
Explosion.BottomSurface = "Smooth"
Explosion.CanCollide = false
Explosion.Parent = x
Explosion.Transparency = 0.7
Explosion.Size = Vector3.new(20,20,20)
Explosion.Position = x.Position
Explosion.Anchored = true
AmmoE = AmmoE - 1
local StartNumber = 24
if Explosion.Touched:Connect(function()
if AmmoD == 1 then
game.Players.LocalPlayer.Character.Humanoid:TakeDamage(3)
AmmoD = AmmoD - 1
end
end)
then end
for i = 1,4,1 do
Explosion.Size = Vector3.new(StartNumber, StartNumber, StartNumber)
StartNumber = StartNumber + 4
wait(.05)
end
wait(0.1)
Explosion:Destroy()
AmmoE = 1
end
end)
then wait(2)
Ammo = 1
AmmoD = 1
end
end
end)
Full Code

1 comment
I put in. Got a few errors but fixed them and it doesn't damage myself. But it doesn't damage others either. Any suggestions?