So yeah, I was using a tutorial for tools because I need to improve those for my games, and I made a gun. It's still WIP, of course, but testing does nothing:
Player = game.Players.LocalPlayer
Gun = script.Parent
Ammo = 1
Mouse = Player:GetMouse()
v = Instance.new("BodyVelocity", Bullet)
function Shoot()
if Ammo > 0 then
Bullet = Instance.new("Part", workspace)
game.Debris:AddItem(Bullet, 2)
Bullet.Shape = "Ball"
Bullet.Size = Vector3.new (0.2, 0.2, 0.2)
Bullet.TopSurface = "Smooth"
Bullet.BottomSurface = "Smooth"
Bullet.BrickColor = BrickColor.new("Black")
Bullet.canCollide = false
Bullet.CFrame = Gun.Handle.CFrame
Bullet.CFrame = CFrame.new(Bullet.Position, Mouse.Hit.p)
v = Instance.new("BodyVelocity", Bullet)
v.velocity = Bullet.CFrame.lookVector *90
v.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
end
end
Gun.activated:Connect(Shoot) |