Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player=game.Players.LocalPlayer
- local tool=Instance.new("Tool", player.Backpack)
- local handle=Instance.new("Part", tool)
- local mesh=Instance.new("SpecialMesh", handle)
- mesh.MeshId="rbxasset://fonts/PaintballGun.mesh"
- mesh.TextureId="rbxasset://textures/PaintballGunTex128.png"
- tool.RequiresHandle=true
- handle.Name="Handle"
- tool.Equipped:connect(function(mouse)
- handle.CFrame=handle.CFrame*CFrame.Angles(180, 0, 0)
- print("Tool equipped!")
- player.Character.Humanoid.WalkSpeed=50
- mouse.Button1Down:connect(function()
- print("Mouse pressed!")
- local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p - tool.Handle.CFrame.p).unit * 300)
- local part, position = workspace:FindPartOnRay(ray, player.Character, false, true)
- local beam = Instance.new("Part", workspace)
- beam.BrickColor = BrickColor.new("Bright red")
- beam.FormFactor = "Custom"
- beam.Material = "Neon"
- beam.Transparency = 0.25
- beam.Anchored = true
- beam.Locked = true
- beam.CanCollide = false
- local distance = (tool.Handle.CFrame.p - position).magnitude
- beam.Size = Vector3.new(0.3, 0.3, distance)
- beam.CFrame = CFrame.new(tool.Handle.CFrame.p, position) * CFrame.new(0, 0, -distance / 2)
- game:GetService("Debris"):AddItem(beam, 0.1)
- if part then
- local e=Instance.new("Explosion",part)
- e.BlastRadius=30
- e.BlastPressure=1
- e.Position=part.Position
- part.Anchored=false
- end
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement