Guest User

Pistol Script

a guest
May 12th, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. Player = game.Players.LocalPlayer
  2. Gun = script.Parent
  3. Ammo = 20
  4. mouse = Player:GetMouse ()
  5. enabled = true
  6. function = Shoot ()
  7. if Ammo >= 1 and enabled == true then
  8. Ammo = Ammo -1
  9. enabled = false
  10. Bullet = Instance.new ("Part", Workspace)
  11. Gun.GripPos.Y = Vector3.new (0, -0.35, -0.4)
  12. game.Debris:AddItem (Bullet, 2)
  13. Bullet.shape = "Cube"
  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")
  18. Bullet.CanCollide = false
  19. Bullet.CFrame = Gun.Handle.CFrame
  20. Bullet.CFrame = CFrame.new (Bullet.Position, mouse.Hit.p)
  21. v = instance.new ("BodyVelocity", Bullet)
  22. v.velocity = Bullet.CFrame.lookVector *90
  23. v.maxForce = Vector3.new (math.huge, math.huge, math.huge)
  24. FireSound = Instance.new ("Sound", Bullet)
  25. FireSound.SoundId = "https://www.roblox.com/Gunshot-item?id=130770091"
  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 ()
  32. game.Debris:AddItem (FireSound, 2)
  33. wait (0.2)
  34. Gun.GripPos.Y = Vector3.new (0, -0.6, -0.4)
  35. wait ()
  36. enabled = true
  37. end
  38. end
Add Comment
Please, Sign In to add comment