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 and TargetPart:GetMass() < 16 and TargetPart.Name ~= "RandomGunObject" and not TargetPart:IsDescendantOf(Character) then
- local success,err = pcall(function()
- TargetPart.Material = Enum.Material.Neon
- TweenService:Create(TargetPart,TweenInfo.new(.5),{Color = Color3.fromRGB(255,255,255)}):Play()
- coroutine.resume(coroutine.create(function()
- wait(.2)
- local RNG = math.random(1,#ObjectList)
- local Object = ObjectList[RNG]
- local Part = Instance.new("Part",workspace)
- Part.Name = "RandomGunObject"
- Part.CFrame = TargetPart.CFrame
- TargetPart:Destroy()
- local ObjectMesh = Instance.new("SpecialMesh",Part)
- if Object == "ChillHead" then
- Part.Size = Vector3.new(1.5,1.75,1.75)
- ObjectMesh.MeshId = "rbxassetid://4676559534"
- ObjectMesh.TextureId = "rbxassetid://4676559661"
- elseif Object == "Plunger" then
- Part.Size = Vector3.new(1,2.75,1)
- ObjectMesh.MeshId = "rbxassetid://1839892075"
- ObjectMesh.TextureId = "rbxassetid://1839892112"
- ObjectMesh.Scale = Vector3.new(.25,.25,.25)
- elseif Object == "Bear" then
- Part.Size = Vector3.new(1,1,1.5)
- ObjectMesh.MeshId = "http://www.roblox.com/asset/?id=12218321"
- ObjectMesh.TextureId = "http://www.roblox.com/asset/?id=12218077"
- ObjectMesh.Scale = Vector3.new(.5,.5,.5)
- elseif Object == "Potato" then
- Part.Size = Vector3.new(1,1.25,1)
- ObjectMesh.MeshId = "rbxassetid://477543051"
- ObjectMesh.TextureId = "rbxassetid://477543054"
- elseif Object == "Chicken" then
- Part.Size = Vector3.new(1,2,2)
- ObjectMesh.MeshId = "rbxassetid://438720618"
- ObjectMesh.TextureId = "rbxassetid://438720622"
- ObjectMesh.Scale = Vector3.new(.25,.25,.25)
- elseif Object == "MNM" then
- Part.Size = Vector3.new(2.25,1.5,.75)
- ObjectMesh.MeshId = "rbxassetid://2840788409"
- ObjectMesh.TextureId = "rbxassetid://2840788436"
- ObjectMesh.Scale = Vector3.new(1.5,1.5,1.5)
- elseif Object == "Sans" then
- Part.Size = Vector3.new(1.5,1.5,1.5)
- ObjectMesh.MeshId = "rbxassetid://430073345"
- ObjectMesh.TextureId = "rbxassetid://430073362"
- ObjectMesh.Scale = Vector3.new(.75,.75,.75)
- elseif Object == "Frog" then
- Part.Size = Vector3.new(1,1.5,.75)
- ObjectMesh.MeshId = "rbxassetid://890005142"
- ObjectMesh.TextureId = "rbxassetid://890005160"
- ObjectMesh.Scale = Vector3.new(3,3,3)
- elseif Object == "Baguette" then
- Part.Size = Vector3.new(.5,.25,1.5)
- ObjectMesh.MeshId = "rbxassetid://2803509055"
- ObjectMesh.TextureId = "rbxassetid://2803509851"
- elseif Object == "Duck" then
- Part.Size = Vector3.new(1,1,1.5)
- ObjectMesh.MeshId = "rbxassetid://521754610"
- ObjectMesh.TextureId = "rbxassetid://521754612"
- elseif Object == "Mario" then
- Part.Size = Vector3.new(1.25,1.5,1.5)
- ObjectMesh.MeshId = "rbxassetid://849882710"
- ObjectMesh.TextureId = "rbxassetid://849882719"
- ObjectMesh.Scale = Vector3.new(.25,.25,.25)
- elseif Object == "Squidward" then
- Part.Size = Vector3.new(1.5,1.75,.75)
- ObjectMesh.MeshId = "rbxassetid://430074487"
- ObjectMesh.TextureId = "rbxassetid://430074495"
- end
- end))
- end)
- if not success then
- print(err)
- end
- end
- end
- end
- end))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement