Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Services --
- local Players = game:GetService("Players")
- local TweenService = game:GetService("TweenService")
- -- Variables --
- local Player = owner
- repeat wait() until Player.Character
- local Character = Player.Character
- local Tool = Instance.new("Tool",Player.Backpack)
- local Gun = Instance.new("Part",Tool)
- local GunMesh = Instance.new("SpecialMesh",Gun)
- local MousePos
- IsFiring = false
- Intt = 0
- Colors = {
- Color3.fromRGB(255,0,0),
- Color3.fromRGB(0,255,0),
- Color3.fromRGB(0,0,255)
- }
- ObjectList = {
- "ChillHead",
- "Plunger",
- "Bear",
- "Potato",
- "Chicken",
- "MNM",
- "Sans",
- "Frog",
- "Baguette",
- "Duck",
- "Mario",
- "Squidward"
- }
- -- Mouse Event --
- local MouseEvent = Instance.new("RemoteEvent")
- MouseEvent.Name = "MouseEvent"
- MouseEvent.Parent = NLS([==[
- local Mouse = game:GetService("Players").LocalPlayer:GetMouse()
- while wait() do
- script.MouseEvent:FireServer(Mouse.Hit.p)
- end
- ]==],Player.PlayerGui)
- MouseEvent.OnServerEvent:Connect(function(Plr,MouseLocation)
- if Plr == Player and MouseLocation then
- MousePos = MouseLocation
- end
- end)
- -- Functions --
- Tool.Equipped:Connect(function()
- local Theme = Instance.new("Sound",Gun)
- Theme.Looped = true
- Theme.Volume = 3
- Theme.SoundId = "rbxassetid://413176884"
- Theme:Play()
- end)
- Tool.Unequipped:Connect(function()
- for i,v in pairs(Gun:GetChildren()) do
- if v:IsA("Sound") then
- v:Destroy()
- end
- end
- IsFiring = false
- end)
- Tool.Activated:Connect(function()
- IsFiring = true
- local Sound = Instance.new("Sound",Gun)
- Sound.Name = "FiringSound"
- Sound.Looped = true
- Sound.Volume = 3
- Sound.SoundId = "rbxassetid://2371488630"
- Sound:Play()
- end)
- Tool.Deactivated:Connect(function()
- IsFiring = false
- if Gun:FindFirstChild("FiringSound") then
- Gun.FiringSound:Destroy()
- end
- end)
- -- Base Code --
- Gun.Size = Vector3.new(.5,.5,.5)
- Gun.CanCollide = false
- Gun.Massless = true
- Gun.Locked = true
- Gun.Name = "Handle"
- GunMesh.Scale = Vector3.new(0.55,0.55,0.55)
- GunMesh.MeshId = "rbxassetid://641905504"
- GunMesh.Offset = Vector3.new(0,-0.5,2.7)
- Tool.TextureId = "http://www.roblox.com/asset/?id=924922390"
- Tool.ToolTip = "bbbbblllppplbbb"
- Tool.Grip = CFrame.new(0.146357164, -0.69461441, 3.63811111, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- -- Loops --
- coroutine.resume(coroutine.create(function()
- while wait(.5) do
- if Intt == #Colors then
- Intt = 0
- end
- Intt = Intt+1
- TweenService:Create(Gun,TweenInfo.new(1),{Color = Colors[Intt]}):Play()
- end
- end))
- coroutine.resume(coroutine.create(function()
- while wait(.1) do
- if IsFiring then
- local MuzzleFlash = Instance.new("Part",Gun)
- game.Debris:AddItem(MuzzleFlash,.2)
- MuzzleFlash.Name = "MuzzleFlash"
- MuzzleFlash.CanCollide = false
- MuzzleFlash.Material = Enum.Material.Neon
- MuzzleFlash.BrickColor = BrickColor.new("New Yeller")
- MuzzleFlash.Size = Vector3.new(.25,.25,.25)
- MuzzleFlash.CastShadow = false
- local MuzzleFlashWeld = Instance.new("Weld",MuzzleFlash)
- MuzzleFlashWeld.Part0 = MuzzleFlash
- MuzzleFlashWeld.Part1 = Gun
- MuzzleFlashWeld.C0 = CFrame.new(0,0,0)*CFrame.Angles(math.rad(math.random(1,360)),math.rad(math.random(1,360)),math.rad(math.random(1,360)))
- local MuzzleFlashLight = Instance.new("PointLight",MuzzleFlash)
- MuzzleFlashLight.Color = Color3.fromRGB(255,255,0)
- TweenService:Create(MuzzleFlash,TweenInfo.new(.2),{Size = Vector3.new(1,1,1);Color = Color3.fromRGB(213,115,61);Transparency = 1}):Play()
- local ray = Ray.new(Gun.CFrame.p,(MousePos-Gun.CFrame.p).unit*300)
- local IgnoreList = {}
- table.insert(IgnoreList,Gun)
- for i,v in pairs(Gun:GetDescendants()) do
- table.insert(IgnoreList,v)
- end
- for i,v in pairs(Character:GetDescendants()) do
- table.insert(IgnoreList,v)
- end
- local TargetPart,Pos = workspace:FindPartOnRayWithIgnoreList(ray,IgnoreList)
- local Distance = (Gun.CFrame.p - Pos).magnitude
- local Beam = Instance.new("Part",Gun)
- Beam.BrickColor = BrickColor.new("New Yeller")
- Beam.Material = Enum.Material.Neon
- Beam.Locked = true
- Beam.Anchored = true
- Beam.CanCollide = false
- Beam.CastShadow = false
- Beam.Size = Vector3.new(0.1,0.1,Distance)
- Beam.CFrame = CFrame.new(Gun.CFrame.p,Pos)*CFrame.new(0,0,-Distance/2)
- game.Debris:AddItem(Beam,.2)
- TweenService:Create(Beam,TweenInfo.new(.2),{Size = Vector3.new(.5,.5,Distance);Transparency = 1;Color = Color3.fromRGB(213,115,61)}):Play()
- local Effect = Instance.new("Part",Gun)
- Effect.Name = "Effect"
- Effect.Material = Enum.Material.Neon
- Effect.Shape = Enum.PartType.Ball
- Effect.BrickColor = BrickColor.new("New Yeller")
- Effect.Size = Vector3.new(.25,.25,.25)
- Effect.CanCollide = false
- Effect.Anchored = true
- Effect.CastShadow = false
- Effect.Position = Pos
- game.Debris:AddItem(Effect,.2)
- TweenService:Create(Effect,TweenInfo.new(.2),{Size = Vector3.new(3,3,3);Transparency = 1;Color = Color3.fromRGB(213,115,61)}):Play()
- if TargetPart then
- if TargetPart.Parent and TargetPart.Parent:FindFirstChild("Humanoid") then
- TargetPart.Parent.Humanoid:TakeDamage(10)
- end
- end
- end
- end
- end))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement