SHOW:
|
|
- or go back to the newest paste.
1 | Player = game.Players.LocalPlayer | |
2 | Gun = script.Parent | |
3 | Ammo = 20 | |
4 | - | mouse = Player:GetMouse () |
4 | + | mouse = Player:GetMouse() |
5 | enabled = true | |
6 | - | function = Shoot () |
6 | + | function = Shoot() |
7 | if Ammo >= 1 and enabled == true then | |
8 | Ammo = Ammo -1 | |
9 | enabled = false | |
10 | - | Bullet = Instance.new ("Part", Workspace) |
10 | + | Bullet = Instance.new("Part", Workspace) |
11 | - | Gun.GripPos.Y = Vector3.new (0, -0.35, -0.4) |
11 | + | Gun.GripPos.Y = Vector3.new(0, -0.35, -0.4) |
12 | - | game.Debris:AddItem (Bullet, 2) |
12 | + | game.Debris:AddItem(Bullet, 2) |
13 | Bullet.shape = "Cube" | |
14 | - | Bullet.size = Vector3.new (0.1, 0.1, 0.1) |
14 | + | Bullet.size = Vector3.new(0.1, 0.1, 0.1) |
15 | Bullet.TopSurface = "Smooth" | |
16 | Bullet.BottomSurface = "Smooth" | |
17 | - | Bullet.BrickColor = BrickColor.new ("Dark stone blue") |
17 | + | Bullet.BrickColor = BrickColor.new("Dark stone blue") |
18 | Bullet.CanCollide = false | |
19 | Bullet.CFrame = Gun.Handle.CFrame | |
20 | - | Bullet.CFrame = CFrame.new (Bullet.Position, mouse.Hit.p) |
20 | + | Bullet.CFrame = CFrame.new(Bullet.Position, mouse.Hit.p) |
21 | - | v = instance.new ("BodyVelocity", Bullet) |
21 | + | v = instance.new("BodyVelocity", Bullet) |
22 | v.velocity = Bullet.CFrame.lookVector *90 | |
23 | - | v.maxForce = Vector3.new (math.huge, math.huge, math.huge) |
23 | + | v.maxForce = Vector3.new(math.huge, math.huge, math.huge) |
24 | - | FireSound = Instance.new ("Sound", Bullet) |
24 | + | FireSound = Instance.new("Sound", Bullet) |
25 | FireSound.SoundId = "https://www.roblox.com/Gunshot-item?id=130770091" | |
26 | - | RP = math.random (60,80) |
26 | + | RP = math.random(60,80) |
27 | RP = RP /10 | |
28 | FireSound.Pitch = 0.8 | |
29 | RV = RV /10 | |
30 | FireSound.Volume = RV | |
31 | - | FireSound:Play () |
31 | + | FireSound:Play() |
32 | - | game.Debris:AddItem (FireSound, 2) |
32 | + | game.Debris:AddItem(FireSound, 2) |
33 | wait (0.2) | |
34 | - | Gun.GripPos.Y = Vector3.new (0, -0.6, -0.4) |
34 | + | Gun.GripPos.Y = Vector3.new(0, -0.6, -0.4) |
35 | - | wait () |
35 | + | wait() |
36 | enabled = true | |
37 | end | |
38 | end |