Advertisement
RobloxScripTTPoster

(Doors) Create Custom Gun Script

Dec 5th, 2022
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1. local Functions = loadstring(game:HttpGet("https://raw.githubusercontent.com/RegularVynixu/Utilities/main/Functions.lua"))()
  2. local CustomShop = loadstring(game:HttpGet("https://raw.githubusercontent.com/RegularVynixu/Utilities/main/Doors/Custom%20Shop%20Items/Source.lua"))()
  3.  
  4. -- Create your tool here
  5. local exampleTool = LoadCustomInstance("rbxassetid://11714080455") --The gun model id
  6.  
  7. -- Create custom shop item
  8. CustomShop.CreateItem(exampleTool, {
  9. Title = "Candy cane gun",
  10. Desc = "*Tickles Pickle",
  11. Image = "https://cdn.discordapp.com/attachments/1041874959665991793/1047944359926050896/image-removebg-preview.png",
  12. Price = "fatty",
  13. Stack = 1,
  14. })
  15.  
  16.  
  17. local UIS = game:GetService("UserInputService")
  18. local tool = exampleTool
  19.  
  20. local anim = Instance.new("Animation")
  21. anim.Name = "M249Idle"
  22. anim.AnimationId = "rbxassetid://3034291703"
  23. local track = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(anim)
  24.  
  25. tool.Equipped:Connect(function()
  26. track.Priority = Enum.AnimationPriority.Movement
  27. track.Looped = true
  28. track:Play()
  29. end)
  30.  
  31. UIS.InputBegan:Connect(function(input)
  32. if tool.Parent == game.Players.LocalPlayer.Character then
  33. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  34. local bullet = LoadCustomInstance("rbxassetid://11713884211") --The *bullet model id*
  35. bullet.Anchored = false
  36. local HRP = tool.BulletPart
  37. local Attachment = Instance.new("Attachment", bullet)
  38. local LV = Instance.new("LinearVelocity", Attachment) -- creating the linear velocity
  39. LV.MaxForce = math.huge -- no need to worry about this
  40. LV.VectorVelocity = HRP.CFrame.lookVector * 300 -- change 100 with how fast you want the projectile to go
  41. LV.Attachment0 = Attachment --Required Attachment
  42. bullet.Parent = game.Workspace
  43. bullet.CFrame = tool.BulletPart.CFrame
  44. tool.Handle.Fire:Play()
  45. tool.flash.BillboardGui.ImageLabel.Visible = true
  46. wait(1)
  47. LV:Destroyw()
  48. wait(10)
  49. bullet:Destroy()
  50. end
  51. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement