Advertisement
RobloxScripTTPoster

(Doors) Vynixiu's M249 Script

Dec 2nd, 2022
1,345
2
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.39 KB | None | 2 0
  1. -- Services
  2.  
  3. local Players = game:GetService("Players")
  4. local UIS = game:GetService("UserInputService")
  5.  
  6. -- Variables
  7.  
  8. local Plr = Players.LocalPlayer
  9. local Char = Plr.Character or Plr.CharacterAdded:Wait()
  10. local Hum = Char:WaitForChild("Humanoid")
  11. local RightArm = Char:WaitForChild("RightUpperArm")
  12. local LeftArm = Char:WaitForChild("LeftUpperArm")
  13. local RightHand = Char:WaitForChild("RightHand")
  14. local Mouse = Plr:GetMouse()
  15.  
  16. local RightC1 = RightArm.RightShoulder.C1
  17. local LeftC1 = LeftArm.LeftShoulder.C1
  18.  
  19. local SelfModules = {
  20. Functions = loadstring(game:HttpGet("https://raw.githubusercontent.com/RegularVynixu/Utilities/main/Functions.lua"))(),
  21. CustomShop = loadstring(game:HttpGet("https://raw.githubusercontent.com/RegularVynixu/Utilities/main/Doors/Custom%20Shop%20Items/Source.lua"))(),
  22. }
  23. local ModuleScripts = {
  24. MainGame = require(Plr.PlayerGui.MainUI.Initiator.Main_Game),
  25. }
  26.  
  27. -- Functions
  28.  
  29. -- Scripts
  30.  
  31. local Gun = LoadCustomInstance("https://github.com/lopvi/Doors/blob/main/M249.rbxm?raw=true")
  32.  
  33. if typeof(Gun) == "Instance" and Gun.ClassName == "Tool" then
  34. Gun.Equipped:Connect(function()
  35. RightArm.Name = "R_Arm"
  36. LeftArm.Name = "L_Arm"
  37.  
  38. local rightGrip = RightHand:WaitForChild("RightGrip")
  39.  
  40. RightArm.RightShoulder.C1 = RightC1 * CFrame.Angles(math.rad(-90), math.rad(-35), 0)
  41. LeftArm.LeftShoulder.C1 = LeftC1 * CFrame.new(1, 1, 0) * CFrame.Angles(math.rad(-80), math.rad(35), 0)
  42. rightGrip.C1 = rightGrip.C1 * CFrame.Angles(0, math.rad(35), 0)
  43. end)
  44.  
  45. Gun.Unequipped:Connect(function()
  46. RightArm.Name = "RightUpperArm"
  47. LeftArm.Name = "LeftUpperArm"
  48.  
  49. RightArm.RightShoulder.C1 = RightC1
  50. LeftArm.LeftShoulder.C1 = LeftC1
  51. end)
  52. end
  53. Gun.Activated:Connect(function()
  54. while UIS.IsMouseButtonPressed(UIS, Enum.UserInputType.MouseButton1) and Char.FindFirstChild(Char, Gun.Name) and Hum.Health > 0 do
  55. -- Sound
  56.  
  57. local sound = Gun.Shoot:Clone()
  58. sound.PlayOnRemove = true
  59. sound.Parent = workspace
  60. sound:Destroy()
  61.  
  62. -- Shoot visual
  63.  
  64. Gun.Barrel.Attachment.Particles:Emit(1)
  65.  
  66. -- Cam shake
  67.  
  68. ModuleScripts.MainGame.camShaker:ShakeOnce(20, 10, 0.05, 0.05)
  69.  
  70. -- Bullet ray
  71.  
  72. local bulletRay = Ray.new(Gun.Barrel.Position, (Mouse.Hit.Position - Gun.Barrel.Position).Unit * 100)
  73. local found = workspace:FindPartOnRayWithIgnoreList(bulletRay, {Char})
  74.  
  75. if found then
  76. local entity = nil
  77.  
  78. for _, v in next, workspace:GetChildren() do
  79. if v.GetAttribute(v, "IsCustomEntity") and found.IsDescendantOf(found, v) then
  80. entity = v
  81.  
  82. break
  83. end
  84. end
  85.  
  86. if entity then
  87. local health = entity:GetAttribute("Health") or 1
  88. health -= 1
  89.  
  90. entity:SetAttribute("Health", health)
  91.  
  92. if health == 0 then
  93. entity:Destroy()
  94. end
  95. end
  96. end
  97.  
  98. task.wait(0.1)
  99. end
  100. end)
  101.  
  102.  
  103. Gun.Parent = game.Players.LocalPlayer.Backpack
Advertisement
Comments
  • Evdak90q
    177 days
    # text 0.11 KB | 0 0
    1. U found this script!!!
    2. Can you do mobile version now? It dont shots on mobile but actually gives the item!
Add Comment
Please, Sign In to add comment
Advertisement