Advertisement
mr2meows

gun

Mar 17th, 2023 (edited)
534
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.35 KB | None | 0 0
  1. local tool = Instance.new("Tool",owner.Backpack)
  2. local handle = Instance.new("Part",tool)
  3. handle.Name = "Handle"
  4. tool.Name = "gun"
  5. handle.Size = Vector3.new(1,1,2)
  6. handle.BrickColor = BrickColor.new("Fossil")
  7. handle.Material = "Metal"
  8. handle.Reflectance = 0.5
  9. handle.Anchored = false
  10. local clik = Instance.new("Sound",handle)
  11. clik.SoundId = "rbxasset://sounds//paintball.wav"
  12. local clunk = Instance.new("Sound",handle)
  13. clunk.SoundId = "rbxassetid://9113568235"
  14. local hit = Instance.new("Sound",handle)
  15. hit.SoundId = "rbxassetid://9113963768"
  16. function touch(part)
  17.     --clunk:Play()
  18.     part.Color = grenade.Color
  19.     if part.Parent.Humanoid then
  20.         hit:Play()
  21.         part.Parent.Humanoid:TakeDamage(7)
  22.     end
  23.     wait(1)
  24.     grenade:Destroy()
  25. end
  26. function launch()
  27.     clik:Play()
  28.     grenade = Instance.new("Part",workspace)
  29.     grenade.Size = Vector3.new(1,1,1)
  30.     grenade.Shape = "Ball"
  31.     grenade.BrickColor = BrickColor.Random()
  32.     grenade.CanCollide = true
  33.     grenade.Anchored = false
  34.     local spawnPosition = (handle.CFrame * CFrame.new(0, 0, -5)).p
  35.     grenade.CFrame = CFrame.new(spawnPosition) --NOTE: This must be done before assigning Parent
  36.     grenade.Velocity = tool.Parent.Head.CFrame.lookVector * 64
  37.     Instance.new('BodyForce', grenade).Force = Vector3.new(0, grenade:GetMass() * (workspace.Gravity * .88), 0)
  38.     grenade.Touched:Connect(touch)
  39. end
  40. tool.Activated:Connect(launch)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement