Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---creationed by IwasVivedVenom2
- --Converted with ttyyuu12345's model to script plugin v4
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- Tool0 = Instance.new("Tool")
- LocalScript1 = Instance.new("LocalScript")
- Vector3Value2 = Instance.new("Vector3Value")
- IntValue3 = Instance.new("IntValue")
- BoolValue4 = Instance.new("BoolValue")
- IntValue5 = Instance.new("IntValue")
- BoolValue6 = Instance.new("BoolValue")
- Animation7 = Instance.new("Animation")
- BoolValue8 = Instance.new("BoolValue")
- ScreenGui9 = Instance.new("ScreenGui")
- Frame10 = Instance.new("Frame")
- Frame11 = Instance.new("Frame")
- Frame12 = Instance.new("Frame")
- ImageLabel13 = Instance.new("ImageLabel")
- ImageLabel14 = Instance.new("ImageLabel")
- Frame15 = Instance.new("Frame")
- ImageLabel16 = Instance.new("ImageLabel")
- ImageLabel17 = Instance.new("ImageLabel")
- ImageLabel18 = Instance.new("ImageLabel")
- Frame19 = Instance.new("Frame")
- Frame20 = Instance.new("Frame")
- ImageLabel21 = Instance.new("ImageLabel")
- ImageLabel22 = Instance.new("ImageLabel")
- Frame23 = Instance.new("Frame")
- ImageLabel24 = Instance.new("ImageLabel")
- ImageLabel25 = Instance.new("ImageLabel")
- Animation26 = Instance.new("Animation")
- Animation27 = Instance.new("Animation")
- SpecialMesh28 = Instance.new("SpecialMesh")
- Script29 = Instance.new("Script")
- Script30 = Instance.new("Script")
- Script31 = Instance.new("Script")
- Script32 = Instance.new("Script")
- Script33 = Instance.new("Script")
- Script34 = Instance.new("Script")
- LocalScript35 = Instance.new("LocalScript")
- LocalScript36 = Instance.new("LocalScript")
- Part37 = Instance.new("Part")
- Sound38 = Instance.new("Sound")
- Sound39 = Instance.new("Sound")
- SpecialMesh40 = Instance.new("SpecialMesh")
- Tool0.Name = "Trenchgun"
- Tool0.Parent = mas
- Tool0.TextureId = "rbxassetid://94252022"
- Tool0.GripForward = Vector3.new(-0.500696421, -0.104253426, -0.859321952)
- Tool0.GripPos = Vector3.new(0.0644919276, -0.358220965, 0.191235617)
- Tool0.GripRight = Vector3.new(0.865328908, -0.0344124958, -0.500021636)
- Tool0.GripUp = Vector3.new(-0.0225575566, 0.993955255, -0.107443735)
- LocalScript1.Parent = Tool0
- table.insert(cors,sandbox(LocalScript1,function()
- -- Made by Stickmasterluke
- -- edited by fusroblox
- function WaitForChild(obj, name)
- while not obj:FindFirstChild(name) do
- wait()
- print("1waiting for " .. name)
- end
- return obj:FindFirstChild(name)
- end
- local function FindCharacterAncestor(subject)
- if subject and subject ~= Workspace then
- if subject:FindFirstChild('Humanoid') then
- return subject
- else
- return FindCharacterAncestor(subject.Parent)
- end
- end
- return nil
- end
- local Tool = script.Parent
- local GunObj ={
- Reloading = "http://www.roblox.com/asset/?id=94155503",
- Cursors = {
- "http://www.roblox.com/asset/?id=94154683", -- black
- "http://www.roblox.com/asset/?id= 94154829", -- red
- "http://www.roblox.com/asset/?id=94155503",
- "http://www.roblox.com/asset/?id=94155569"
- },
- ClipSize = 30,
- Equipped = false,
- Player = game.Players.localPlayer,
- Ammo = WaitForChild(script.Parent,"Ammo"),
- Clips,
- Gui = WaitForChild(Tool,"AmmoHud"),
- NumberImages={},
- IdleAni,
- MyMouse
- }
- local ChestWeld
- Tool.Equipped:connect(function(mouse) GunObj:OnEquipped(mouse) end)
- local initialized=false
- function GunObj:Initialize()
- if initialized then return end
- initialized=true
- self.Ammo.Changed:connect(function()self:UpdateGui()end)
- WaitForChild(Tool, "Reloading")
- print('got to connections!!!!! ')
- Tool.Reloading.Changed:connect(function() self:UpdateGui() end)
- Tool.Unequipped:connect(function() self:OnUnequipped() end)
- Tool.DoFireAni.Changed:connect(PlayFireAni)
- self.NumberImages['0']=94128401
- self.NumberImages['1']=94128421
- self.NumberImages['2']=94128434
- self.NumberImages['3']=94128446
- self.NumberImages['4']=94128466
- self.NumberImages['5']=94128485
- self.NumberImages['6']=94128496
- self.NumberImages['7']=94128523
- self.NumberImages['8']=94128538
- self.NumberImages['9']=94128538
- local bar=WaitForChild(self.Gui,'Bar')
- self:UpdateNumbers(self.ClipSize..'', WaitForChild(bar,'TotalAmmo'))
- end
- function GunObj:UpdateNumbers(data,frame)
- if string.len(data)==0 then
- data= '0'..data
- end
- if string.len(data)==1 then
- data= '0'..data
- end
- local digit=WaitForChild(WaitForChild(frame,'1'),'digit')
- if digit.Image ~='http://www.roblox.com/asset/?id='..self.NumberImages[string.sub(data,1,1)] then
- local ndigit=digit:Clone()
- ndigit.Position=UDim2.new(ndigit.Position.X.Scale,ndigit.Position.X.Offset,ndigit.Position.Y.Scale,ndigit.Position.Y.Offset-65)
- ndigit.Image='http://www.roblox.com/asset/?id='..self.NumberImages[string.sub(data,1,1)]
- ndigit.Parent=digit.Parent
- ndigit:TweenPosition(digit.Position, "Out", "Quad", .1,true)
- digit.Name='oldDigit'
- digit:TweenPosition(UDim2.new(digit.Position.X.Scale,digit.Position.X.Offset,digit.Position.Y.Scale,
- digit.Parent.Position.Y.Offset+95), "Out", "Quad", .25,true)
- game.Debris:AddItem(digit,1)
- end
- digit=WaitForChild(WaitForChild(frame,'2'),'digit')
- if digit.Image ~='http://www.roblox.com/asset/?id='..self.NumberImages[string.sub(data,2,2)] then
- ndigit=digit:Clone()
- ndigit.Position=UDim2.new(ndigit.Position.X.Scale,ndigit.Position.X.Offset,ndigit.Position.Y.Scale,ndigit.Position.Y.Offset-65)
- ndigit.Image='http://www.roblox.com/asset/?id='..self.NumberImages[string.sub(data,2,2)]
- ndigit.Parent=digit.Parent
- ndigit:TweenPosition(UDim2.new(digit.Position.X.Scale,digit.Position.X.Offset,digit.Position.Y.Scale,0), "Out", "Quad", .25,true)
- digit.Name='oldDigit'
- digit:TweenPosition(UDim2.new(digit.Position.X.Scale,digit.Position.X.Offset,digit.Position.Y.Scale,
- digit.Parent.Position.Y.Offset+95), "Out", "Quad", .25,true)
- game.Debris:AddItem(digit,1)
- end
- end
- function GunObj:UpdateGui()
- if self.Equipped then
- local Player = game.Players.localPlayer
- if Player ~= nil then
- if self.Ammo == nil then
- --self.Gui.Bar.GunLabel.Text ="Futuro Heavy Pistol"
- --self.Gui.Bar.AmmoLabel.Text = ""
- else
- --self.Gui.Bar.GunLabel.Text ="Futuro Heavy Pistol"
- --self.Gui.Bar.AmmoLabel.Text = tostring(self.Ammo.Value).."/"..tostring(self.ClipSize)
- self:UpdateNumbers(tostring(self.Ammo.Value),WaitForChild(self.Gui.Bar,'AmmoLeft'))
- end
- if Tool.Reloading.Value then
- --self.Gui.Bar.AmmoLabel.Text = "Reloading"
- end
- end
- end
- end
- function GunObj:CursorUpdate(mouse)
- local reloadCounter=0
- while self.Equipped do
- if Tool.Reloading.Value then
- reloadCounter=reloadCounter+1
- if reloadCounter%20<10 then
- mouse.Icon = self.Cursors[3]
- else
- mouse.Icon = self.Cursors[4]
- end
- elseif mouse.Target and FindCharacterAncestor(mouse.Target) then
- mouse.Icon = self.Cursors[2]
- else
- mouse.Icon = self.Cursors[1]
- end
- wait(1/30)
- end
- end
- local InReload=false
- function GunObj:OnEquipped(mouse)
- self:Initialize()
- if mouse ~= nil then
- self.Equipped = true
- local Player = game.Players.LocalPlayer
- if Player ~= nil then
- local humanoid=WaitForChild(Player.Character,'Humanoid')
- if not self.IdleAni then
- self.IdleAni = humanoid:LoadAnimation(WaitForChild(script.Parent,'idle'))
- self.IdleAni:Play()
- end
- local plrgui = WaitForChild(Player,"PlayerGui")
- self.Gui.Parent = plrgui
- mouse.Button1Down:connect(function()
- if not Tool.Down.Value then
- Tool.Aim.Value = mouse.Hit.p
- Tool.Down.Value = true
- while Tool.Down.Value do
- Tool.Aim.Value = mouse.Hit.p
- wait()
- end
- end
- end)
- mouse.Button1Up:connect(function()
- Tool.Down.Value = false
- end)
- mouse.KeyDown:connect(function(key)
- if key=='r' and not Tool.Reloading.Value and not Tool.Down.Value and self.Ammo.Value ~=8 and self.Ammo.Value ~=0 and not InReload then
- Tool.Reloading.Value=true
- end
- end)
- --mouse.Icon = self.Cursors[1]
- Tool.Reloading.Changed:connect(function(val)
- if mouse ~= nil and self.Equipped then
- if val then
- --mouse.Icon = self.Cursors.Reloading
- else
- --mouse.Icon = self.Cursors[1]
- end
- local Player = game.Players.LocalPlayer
- if Player ~= nil then
- local gui = WaitForChild(Player.PlayerGui, "AmmoHud")
- local humanoid=WaitForChild(Player.Character,'Humanoid')
- self:UpdateGui()
- if Tool.Reloading.Value then
- --gui.Bar.AmmoLabel.Text = "Reloading"
- end
- end
- end
- end)
- self:UpdateGui()
- MyMouse=mouse
- Spawn(function() self:CursorUpdate(mouse) end )
- end
- end
- end
- function GunObj:OnUnequipped()
- if self.IdleAni then
- self.IdleAni:Stop()
- self.IdleAni:Destroy()
- self.IdleAni=nil
- end
- self.Gui.Parent = Tool
- self.Equipped = false
- print('in unequipp')
- if ChestWeld then
- print('chestweldexists')
- ChestWeld:Destroy()
- end
- local Player = game.Players.localPlayer
- if Player ~= nil then
- local gui = WaitForChild(Player.PlayerGui,"AmmoHud")
- --gui.Bar.GunLabel.Text = ""
- --gui.Bar.AmmoLabel.Text = ""
- end
- end
- function PlayFireAni()
- wait(.1)
- local aniTrack = WaitForChild(Tool.Parent,"Humanoid"):LoadAnimation(Tool.FireAni)
- aniTrack:Play(0,1,1.2)
- end
- local function weldBetween(a, b)
- local weld = Instance.new("Weld")
- weld.Part0 = a
- weld.Part1 = b
- weld.C0 = CFrame.new()
- weld.C1 = b.CFrame:inverse() * a.CFrame
- weld.Parent = a
- return weld;
- end
- function PlayReloadAni()
- InReload=true
- local aniTrack = WaitForChild(Tool.Parent,"Humanoid"):LoadAnimation(Tool.Reload)
- local torso=WaitForChild(Tool.Parent,'Torso')
- local oldWeld
- for _,i in pairs(WaitForChild(Tool.Parent,'Right Arm'):GetChildren()) do
- if i:IsA('Weld') and i.Part1==Tool.Handle then
- oldWeld=i
- end
- end
- if not oldWeld then
- print('What... no old weld!')
- return
- end
- ChestWeld= weldBetween(torso,Tool.Handle)
- oldWeld.Part1=nil
- aniTrack:Play(0,1,1)
- wait(0)
- oldWeld.Part1=Tool.Handle
- ChestWeld:Destroy()
- ChestWeld=nil
- InReload=false
- end
- Tool.Reloading.Changed:connect(function() if Tool.Reloading.Value then PlayReloadAni() end end)
- end))
- Vector3Value2.Name = "Aim"
- Vector3Value2.Parent = Tool0
- Vector3Value2.Value = Vector3.new(7370.47461, -428.252258, -6819.59961)
- IntValue3.Name = "Ammo"
- IntValue3.Parent = Tool0
- IntValue3.Value = 374658376
- BoolValue4.Name = "Down"
- BoolValue4.Parent = Tool0
- IntValue5.Name = "NoClips"
- IntValue5.Parent = Tool0
- BoolValue6.Name = "Reloading"
- BoolValue6.Parent = Tool0
- Animation7.Name = "FireAni"
- Animation7.Parent = Tool0
- Animation7.AnimationId = "rbxassetid://94245658"
- BoolValue8.Name = "DoFireAni"
- BoolValue8.Parent = Tool0
- ScreenGui9.Name = "AmmoHud"
- ScreenGui9.Parent = Tool0
- Frame10.Name = "Bar"
- Frame10.Parent = ScreenGui9
- Frame10.Transparency = 1
- Frame10.Size = UDim2.new(0, 200, 0, 60)
- Frame10.Position = UDim2.new(1, -200, 1, -170)
- Frame10.BackgroundTransparency = 1
- Frame10.ClipsDescendants = true
- Frame11.Name = "AmmoLeft"
- Frame11.Parent = Frame10
- Frame11.Transparency = 1
- Frame11.Size = UDim2.new(0, 65, 0, 50)
- Frame11.Position = UDim2.new(0, 10, 0, 5)
- Frame11.BackgroundTransparency = 1
- Frame12.Name = "1"
- Frame12.Parent = Frame11
- Frame12.Transparency = 1
- Frame12.Size = UDim2.new(0, 30, 0, 40)
- Frame12.BackgroundTransparency = 1
- ImageLabel13.Parent = Frame12
- ImageLabel13.Transparency = 1
- ImageLabel13.Size = UDim2.new(1, 0, 1, 0)
- ImageLabel13.BackgroundTransparency = 1
- ImageLabel13.ZIndex = 2
- ImageLabel13.Image = "http://www.roblox.com/asset/?id=94130434"
- ImageLabel14.Name = "digit"
- ImageLabel14.Parent = Frame12
- ImageLabel14.Transparency = 1
- ImageLabel14.Size = UDim2.new(0.899999976, 0, 0.899999976, 0)
- ImageLabel14.Position = UDim2.new(0.0500000007, 0, 0.0500000007, 0)
- ImageLabel14.BackgroundTransparency = 1
- ImageLabel14.ZIndex = 2
- ImageLabel14.Image = "http://www.roblox.com/asset/?id=94099941"
- Frame15.Name = "2"
- Frame15.Parent = Frame11
- Frame15.Transparency = 1
- Frame15.Size = UDim2.new(0, 30, 0, 40)
- Frame15.Position = UDim2.new(1, -30, 0, 0)
- Frame15.BackgroundTransparency = 1
- ImageLabel16.Parent = Frame15
- ImageLabel16.Transparency = 1
- ImageLabel16.Size = UDim2.new(1, 0, 1, 0)
- ImageLabel16.BackgroundTransparency = 1
- ImageLabel16.ZIndex = 2
- ImageLabel16.Image = "http://www.roblox.com/asset/?id=94130434"
- ImageLabel17.Name = "digit"
- ImageLabel17.Parent = Frame15
- ImageLabel17.Transparency = 1
- ImageLabel17.Size = UDim2.new(0.899999976, 0, 0.899999976, 0)
- ImageLabel17.Position = UDim2.new(0.0500000007, 0, 0.0500000007, 0)
- ImageLabel17.BackgroundTransparency = 1
- ImageLabel17.ZIndex = 2
- ImageLabel17.Image = "http://www.roblox.com/asset/?id=94099941"
- ImageLabel18.Name = "slash"
- ImageLabel18.Parent = Frame10
- ImageLabel18.Transparency = 1
- ImageLabel18.Size = UDim2.new(0, 30, 0, 40)
- ImageLabel18.Position = UDim2.new(0.5, -20, 0, 5)
- ImageLabel18.BackgroundTransparency = 1
- ImageLabel18.ZIndex = 2
- ImageLabel18.Image = "http://www.roblox.com/asset/?id=94100300"
- Frame19.Name = "TotalAmmo"
- Frame19.Parent = Frame10
- Frame19.Transparency = 1
- Frame19.Size = UDim2.new(0, 65, 0, 50)
- Frame19.Position = UDim2.new(0.5, 10, 0, 5)
- Frame19.BackgroundTransparency = 1
- Frame20.Name = "1"
- Frame20.Parent = Frame19
- Frame20.Transparency = 1
- Frame20.Size = UDim2.new(0, 30, 0, 40)
- Frame20.BackgroundTransparency = 1
- Frame20.ClipsDescendants = true
- ImageLabel21.Parent = Frame20
- ImageLabel21.Transparency = 1
- ImageLabel21.Size = UDim2.new(1, 0, 1, 0)
- ImageLabel21.BackgroundTransparency = 1
- ImageLabel21.ZIndex = 2
- ImageLabel21.Image = "http://www.roblox.com/asset/?id=94130434"
- ImageLabel22.Name = "digit"
- ImageLabel22.Parent = Frame20
- ImageLabel22.Transparency = 1
- ImageLabel22.Size = UDim2.new(0.899999976, 0, 0.899999976, 0)
- ImageLabel22.Position = UDim2.new(0.0500000007, 0, 0.0500000007, 0)
- ImageLabel22.BackgroundTransparency = 1
- ImageLabel22.ZIndex = 2
- ImageLabel22.Image = "http://www.roblox.com/asset/?id=94099941"
- Frame23.Name = "2"
- Frame23.Parent = Frame19
- Frame23.Transparency = 1
- Frame23.Size = UDim2.new(0, 30, 0, 40)
- Frame23.Position = UDim2.new(1, -30, 0, 0)
- Frame23.BackgroundTransparency = 1
- ImageLabel24.Parent = Frame23
- ImageLabel24.Transparency = 1
- ImageLabel24.Size = UDim2.new(1, 0, 1, 0)
- ImageLabel24.BackgroundTransparency = 1
- ImageLabel24.ZIndex = 2
- ImageLabel24.Image = "http://www.roblox.com/asset/?id=94130434"
- ImageLabel25.Name = "digit"
- ImageLabel25.Parent = Frame23
- ImageLabel25.Transparency = 1
- ImageLabel25.Size = UDim2.new(0.899999976, 0, 0.899999976, 0)
- ImageLabel25.Position = UDim2.new(0.0500000007, 0, 0.0500000007, 0)
- ImageLabel25.BackgroundTransparency = 1
- ImageLabel25.ZIndex = 2
- ImageLabel25.Image = "http://www.roblox.com/asset/?id=94099941"
- Animation26.Name = "idle"
- Animation26.Parent = Tool0
- Animation26.AnimationId = "rbxassetid://94242777"
- Animation27.Name = "Reload"
- Animation27.Parent = Tool0
- Animation27.AnimationId = "rbxassetid://94245658"
- SpecialMesh28.Name = "BulletMesh"
- SpecialMesh28.Parent = Tool0
- SpecialMesh28.MeshId = "http://www.roblox.com/asset/?id=95392019"
- SpecialMesh28.Scale = Vector3.new(1.5, 1.5, 1.5)
- SpecialMesh28.TextureId = "http://www.roblox.com/asset/?id=95391833"
- SpecialMesh28.MeshType = Enum.MeshType.FileMesh
- SpecialMesh28.Scale = Vector3.new(1.5, 1.5, 1.5)
- Script29.Name = "Firescript"
- Script29.Parent = Tool0
- table.insert(cors,sandbox(Script29,function()
- -- Made by Stickmasterluke
- -- edited by fusroblox
- local GoreOn=true
- function WaitForChild(parent,child)
- while not parent:FindFirstChild(child) do print("2waiting for " .. child) wait() end
- return parent[child]
- end
- local GunObject = {
- Tool = script.Parent,
- Handle = WaitForChild(script.Parent,'Handle'),
- check = true,
- GunDamage = 27, -- Base output damage per shot.
- FireRate = .7, -- How often the weapon can fire.
- Automatic = false, -- hold down to continue firing
- Range = 250, -- Max distance that the weapon can fire.
- Spread = 7, -- The bigger the spread, the more inaccurate the shots will be.
- ClipSize = 36, -- Shots in a clip
- ReloadTime = 0, -- Time it takes to reload the tool.
- StartingClips = 10, -- If you want infinit clips, remove the IntValue named "Clips" from the tool.
- SegmentLength = 40, -- How long the shot segments are, or the speed of the shot.
- FadeDelayTime = 1/30,
- BarrelPos = CFrame.new(0, 0, - 1.2), -- L, F, U
- Rate = 1/30,
- --local Colors = {BrickColor.new("Bright red"), BrickColor.new("Really red"), BrickColor.new("Dusty Rose"), BrickColor.new("Medium red")}
- Colors = {BrickColor.new("Bright yellow"),BrickColor.new("Mid gray"), BrickColor.new("Medium stone grey"), BrickColor.new("Dark stone grey")},
- FlashColors = {"Medium red", "Dusty Rose", "Bright red", "Really red"},
- Reloading = false,
- Debris = game:GetService("Debris"),
- Ammo,
- Clips,
- LaserObj,
- SparkEffect,
- ShellPart,
- --tool children
- DownVal=WaitForChild(script.Parent, 'Down'),
- AimVal=WaitForChild(script.Parent, 'Aim'),
- ReloadingVal=WaitForChild(script.Parent, 'Reloading'),
- DoFireAni = WaitForChild(script.Parent,'DoFireAni'),
- --handlechildren
- Fire,
- }
- --[[Member functions]]
- function GunObject:Initialize()
- self.Fire=WaitForChild(self.Handle, 'Fire')
- self.Ammo = self.Tool:FindFirstChild("Ammo")
- if self.Ammo ~= nil then
- self.Ammo.Value = self.ClipSize
- end
- self.Clips = self.Tool:FindFirstChild("Clips")
- if self.Clips ~= nil then
- self.Clips.Value = self.StartingClips
- end
- self.Tool.Equipped:connect(function()
- self.Tool.Handle.Fire:Stop()
- self.Tool.Handle.Reload:Stop()
- end)
- self.Tool.Unequipped:connect(function()
- self.Tool.Handle.Fire:Stop()
- self.Tool.Handle.Reload:Stop()
- end)
- self.LaserObj = Instance.new("Part")
- self.LaserObj.Name = "Bullet"
- self.LaserObj.Anchored = true
- self.LaserObj.CanCollide = false
- self.LaserObj.Shape = "Block"
- self.LaserObj.formFactor = "Custom"
- self.LaserObj.Material = Enum.Material.Neon
- self.LaserObj.Locked = true
- self.LaserObj.TopSurface = 0
- self.LaserObj.BottomSurface = 0
- local tSparkEffect = Instance.new("Part")
- tSparkEffect.Name = "Effect"
- tSparkEffect.Anchored = false
- tSparkEffect.CanCollide = false
- tSparkEffect.Shape = "Block"
- tSparkEffect.formFactor = "Custom"
- tSparkEffect.Material = Enum.Material.Neon
- tSparkEffect.Locked = true
- tSparkEffect.TopSurface = 0
- tSparkEffect.BottomSurface = 0
- self.SparkEffect=tSparkEffect
- local tshell = Instance.new('Part')
- tshell.Name='effect'
- tshell.FormFactor='Custom'
- tshell.Size=Vector3.new(1, 0.4, 0.33)
- tshell.BrickColor=BrickColor.new('Bright yellow')
- local tshellmesh=WaitForChild(script.Parent,'BulletMesh'):Clone()
- tshellmesh.Parent=tshell
- self.ShellPart = tshell
- self.DownVal.Changed:connect(function()
- while self.DownVal.Value and self.check and not self.Reloading do
- self.check = false
- local humanoid = self.Tool.Parent:FindFirstChild("Humanoid")
- local plr1 = game.Players:GetPlayerFromCharacter(self.Tool.Parent)
- if humanoid ~= nil and plr1 ~= nil then
- if humanoid.Health > 0 then
- local spos1 = (self.Tool.Handle.CFrame * self.BarrelPos).p
- delay(0, function() self:SendBullet(spos1, self.AimVal.Value, self.Spread, self.SegmentLength, self.Tool.Parent, self.Colors[1], self.GunDamage, self.FadeDelayTime) end)
- else
- self.check = true
- break
- end
- else
- self.check = true
- break
- end
- wait(self.FireRate)
- self.check = true
- if not self.Automatic then
- break
- end
- end
- end)
- self.ReloadingVal.Changed:connect(function() if self.ReloadingVal.Value then self:Reload() end end)
- end
- function GunObject:Reload()
- self.Reloading = true
- self.ReloadingVal.Value = true
- if self.Clips ~= nil then
- if self.Clips.Value > 0 then
- self.Clips.Value = Clips.Value - 1
- else
- self.Reloading = false
- self.ReloadingVal.Value = false
- return
- end
- end
- self.Tool.Handle.Reload:Play()
- for i = 1, self.ClipSize do
- wait(self.ReloadTime/self.ClipSize)
- self.Ammo.Value = i
- end
- self.Reloading = false
- self.Tool.Reloading.Value = false
- end
- function GunObject:SpawnShell()
- local tshell=self.ShellPart:Clone()
- tshell.CFrame=self.Handle.CFrame
- tshell.Parent=Workspace
- game.Debris:AddItem(tshell,2)
- end
- function KnockOffHats(tchar)
- for _,i in pairs(tchar:GetChildren()) do
- if i:IsA('Hat') then
- i.Parent=game.Workspace
- end
- end
- end
- function KnockOffTool(tchar)
- for _,i in pairs(tchar:GetChildren()) do
- if i:IsA('Tool') then
- i.Parent=game.Workspace
- end
- end
- end
- function GunObject:SendBullet(boltstart, targetpos, fuzzyness, SegmentLength, ignore, clr, damage, fadedelay)
- if self.Ammo.Value <=0 then return end
- self.Ammo.Value = self.Ammo.Value - 1
- self:SpawnShell()
- self.Fire.Pitch = 1
- self.Fire:Play()
- self.Volume = 10
- self.Fire.TimePosition = 0
- self.DoFireAni.Value = not self.DoFireAni.Value
- print(self.Fire.Pitch)
- local boltdist = self.Range
- local clickdist = (boltstart - targetpos).magnitude
- local targetpos = targetpos + (Vector3.new(math.random() - .5, math.random() - .5, math.random() - .5) * (clickdist/100) * fuzzyness)
- local boltvec = (targetpos - boltstart).unit
- local totalsegments = math.ceil(boltdist/SegmentLength)
- local lastpos = boltstart
- for i = 1, totalsegments do
- local newpos = (boltstart + (boltvec * (boltdist * (i/totalsegments))))
- local segvec = (newpos - lastpos).unit
- local boltlength = (newpos - lastpos).magnitude
- local bolthit, endpos = CastRay(lastpos, segvec, boltlength, ignore, false)
- DrawBeam(lastpos, endpos, clr, fadedelay, self.LaserObj)
- if bolthit ~= nil then
- local h = bolthit.Parent:FindFirstChild("Humanoid")
- if h ~= nil then
- local plr = game.Players:GetPlayerFromCharacter(self.Tool.Parent)
- if plr ~= nil then
- local creator = Instance.new("ObjectValue")
- creator.Name = "creator"
- creator.Value = plr
- creator.Parent = h
- end
- if hit.Parent:FindFirstChild("BlockShot") then
- hit.Parent:FindFirstChild("BlockShot"):Fire(newpos)
- delay(0, function() self:HitEffect(endpos, BrickColor.new('Bright yellow'),5) end)
- else
- if(hit.Name=='Head') then
- KnockOffHats(hit.Parent)
- end
- if GoreOn then delay(0,function() self:HitEffect(endpos, BrickColor.new('Bright red'),20) end) end
- h:TakeDamage(damage)
- end
- else
- delay(0, function() self:HitEffect(endpos, BrickColor.new('Bright yellow'),5) end)
- end
- break
- end
- lastpos = endpos
- wait(Rate)
- end
- if self.Ammo.Value < 1 then
- self:Reload()
- end
- end
- function GunObject:MakeSpark(pos,tcolor)
- local effect=self.SparkEffect:Clone()
- effect.BrickColor = tcolor
- effect.CFrame = CFrame.new(pos)
- effect.Parent = game.Workspace
- local effectVel = Instance.new("BodyVelocity")
- effectVel.maxForce = Vector3.new(99999, 99999, 99999)
- effectVel.velocity = Vector3.new(math.random() * 15 * SigNum(math.random( - 10, 10)), math.random() * 15 * SigNum(math.random( - 10, 10)), math.random() * 15 * SigNum(math.random( - 10, 10)))
- effectVel.Parent = effect
- effect.Size = Vector3.new(math.abs(effectVel.velocity.x)/30, math.abs(effectVel.velocity.y)/30, math.abs(effectVel.velocity.z)/30)
- wait()
- effectVel:Destroy()
- local effecttime = .5
- game.Debris:AddItem(effect, effecttime * 2)
- local startTime = time()
- while time() - startTime < effecttime do
- if effect ~= nil then
- effect.Transparency = (time() - startTime)/effecttime
- end
- wait()
- end
- if effect ~= nil then
- effect.Parent = nil
- end
- end
- function GunObject:HitEffect(pos,tcolor,numSparks)
- for i = 0, numSparks, 1 do
- Spawn(function() self:MakeSpark(pos,tcolor) end)
- end
- end
- --[[/Member functions]]
- --[[Static functions]]
- function Round(number, decimal)
- decimal = decimal or 0
- local mult = 10^decimal
- return math.floor(number * mult + .5)/mult
- end
- function SigNum(num)
- if num == 0 then return 1 end
- return math.abs(num)/num
- end
- --this is a little bad, but shouldn't really be part of the 'class' of the gun
- local Intangibles = {shock=1, bolt=1, bullet=1, plasma=1, effect=1, laser=1, handle=1, effects=1, flash=1,}
- function CheckIntangible(hitObj)
- print(hitObj.Name)
- return Intangibles[(string.lower(hitObj.Name))] or hitObj.Transparency == 1
- end
- function CastRay(startpos, vec, length, ignore, delayifhit)
- if length > 999 then
- length = 999
- end
- hit, endpos2 = game.Workspace:FindPartOnRay(Ray.new(startpos, vec * length), ignore)
- if hit ~= nil then
- if CheckIntangible(hit) then
- if delayifhit then
- wait()
- end
- hit, endpos2 = CastRay(endpos2 + (vec * .01), vec, length - ((startpos - endpos2).magnitude), ignore, delayifhit)
- end
- end
- return hit, endpos2
- end
- function DrawBeam(beamstart, beamend, clr, fadedelay, templatePart)
- local dis = 2 --(beamstart - beamend).magnitude
- local tlaser=templatePart:Clone()
- tlaser.BrickColor = clr
- tlaser.Size = Vector3.new(.1, .1, dis + .2)
- tlaser.CFrame = CFrame.new((beamend+beamstart)/2, beamstart) * CFrame.new(0, 0, - dis/2)
- tlaser.Parent = game.Workspace
- game.Debris:AddItem(tlaser, fadedelay)
- end
- --[[/Static functions]]
- GunObject:Initialize()
- end))
- Script30.Name = "Firescript"
- Script30.Parent = Tool0
- table.insert(cors,sandbox(Script30,function()
- -- Made by Stickmasterluke
- -- edited by fusroblox
- local GoreOn=true
- function WaitForChild(parent,child)
- while not parent:FindFirstChild(child) do print("2waiting for " .. child) wait() end
- return parent[child]
- end
- local GunObject = {
- Tool = script.Parent,
- Handle = WaitForChild(script.Parent,'Handle'),
- check = true,
- GunDamage = 27, -- Base output damage per shot.
- FireRate = .7, -- How often the weapon can fire.
- Automatic = false, -- hold down to continue firing
- Range = 250, -- Max distance that the weapon can fire.
- Spread = 7, -- The bigger the spread, the more inaccurate the shots will be.
- ClipSize = 36, -- Shots in a clip
- ReloadTime = 0, -- Time it takes to reload the tool.
- StartingClips = 10, -- If you want infinit clips, remove the IntValue named "Clips" from the tool.
- SegmentLength = 40, -- How long the shot segments are, or the speed of the shot.
- FadeDelayTime = 1/30,
- BarrelPos = CFrame.new(0, 0, - 1.2), -- L, F, U
- Rate = 1/30,
- --local Colors = {BrickColor.new("Bright red"), BrickColor.new("Really red"), BrickColor.new("Dusty Rose"), BrickColor.new("Medium red")}
- Colors = {BrickColor.new("Bright yellow"),BrickColor.new("Mid gray"), BrickColor.new("Medium stone grey"), BrickColor.new("Dark stone grey")},
- FlashColors = {"Medium red", "Dusty Rose", "Bright red", "Really red"},
- Reloading = false,
- Debris = game:GetService("Debris"),
- Ammo,
- Clips,
- LaserObj,
- SparkEffect,
- ShellPart,
- --tool children
- DownVal=WaitForChild(script.Parent, 'Down'),
- AimVal=WaitForChild(script.Parent, 'Aim'),
- ReloadingVal=WaitForChild(script.Parent, 'Reloading'),
- DoFireAni = WaitForChild(script.Parent,'DoFireAni'),
- --handlechildren
- Fire,
- }
- --[[Member functions]]
- function GunObject:Initialize()
- self.Fire=WaitForChild(self.Handle, 'Fire')
- self.Ammo = self.Tool:FindFirstChild("Ammo")
- if self.Ammo ~= nil then
- self.Ammo.Value = self.ClipSize
- end
- self.Clips = self.Tool:FindFirstChild("Clips")
- if self.Clips ~= nil then
- self.Clips.Value = self.StartingClips
- end
- self.Tool.Equipped:connect(function()
- self.Tool.Handle.Fire:Stop()
- self.Tool.Handle.Reload:Stop()
- end)
- self.Tool.Unequipped:connect(function()
- self.Tool.Handle.Fire:Stop()
- self.Tool.Handle.Reload:Stop()
- end)
- self.LaserObj = Instance.new("Part")
- self.LaserObj.Name = "Bullet"
- self.LaserObj.Anchored = true
- self.LaserObj.CanCollide = false
- self.LaserObj.Shape = "Block"
- self.LaserObj.formFactor = "Custom"
- self.LaserObj.Material = Enum.Material.Neon
- self.LaserObj.Locked = true
- self.LaserObj.TopSurface = 0
- self.LaserObj.BottomSurface = 0
- local tSparkEffect = Instance.new("Part")
- tSparkEffect.Name = "Effect"
- tSparkEffect.Anchored = false
- tSparkEffect.CanCollide = false
- tSparkEffect.Shape = "Block"
- tSparkEffect.formFactor = "Custom"
- tSparkEffect.Material = Enum.Material.Neon
- tSparkEffect.Locked = true
- tSparkEffect.TopSurface = 0
- tSparkEffect.BottomSurface = 0
- self.SparkEffect=tSparkEffect
- local tshell = Instance.new('Part')
- tshell.Name='effect'
- tshell.FormFactor='Custom'
- tshell.Size=Vector3.new(1, 0.4, 0.33)
- tshell.BrickColor=BrickColor.new('Bright yellow')
- local tshellmesh=WaitForChild(script.Parent,'BulletMesh'):Clone()
- tshellmesh.Parent=tshell
- self.ShellPart = tshell
- self.DownVal.Changed:connect(function()
- while self.DownVal.Value and self.check and not self.Reloading do
- self.check = false
- local humanoid = self.Tool.Parent:FindFirstChild("Humanoid")
- local plr1 = game.Players:GetPlayerFromCharacter(self.Tool.Parent)
- if humanoid ~= nil and plr1 ~= nil then
- if humanoid.Health > 0 then
- local spos1 = (self.Tool.Handle.CFrame * self.BarrelPos).p
- delay(0, function() self:SendBullet(spos1, self.AimVal.Value, self.Spread, self.SegmentLength, self.Tool.Parent, self.Colors[1], self.GunDamage, self.FadeDelayTime) end)
- else
- self.check = true
- break
- end
- else
- self.check = true
- break
- end
- wait(self.FireRate)
- self.check = true
- if not self.Automatic then
- break
- end
- end
- end)
- self.ReloadingVal.Changed:connect(function() if self.ReloadingVal.Value then self:Reload() end end)
- end
- function GunObject:Reload()
- self.Reloading = true
- self.ReloadingVal.Value = true
- if self.Clips ~= nil then
- if self.Clips.Value > 0 then
- self.Clips.Value = Clips.Value - 1
- else
- self.Reloading = false
- self.ReloadingVal.Value = false
- return
- end
- end
- self.Tool.Handle.Reload:Play()
- for i = 1, self.ClipSize do
- wait(self.ReloadTime/self.ClipSize)
- self.Ammo.Value = i
- end
- self.Reloading = false
- self.Tool.Reloading.Value = false
- end
- function GunObject:SpawnShell()
- local tshell=self.ShellPart:Clone()
- tshell.CFrame=self.Handle.CFrame
- tshell.Parent=Workspace
- game.Debris:AddItem(tshell,2)
- end
- function KnockOffHats(tchar)
- for _,i in pairs(tchar:GetChildren()) do
- if i:IsA('Hat') then
- i.Parent=game.Workspace
- end
- end
- end
- function KnockOffTool(tchar)
- for _,i in pairs(tchar:GetChildren()) do
- if i:IsA('Tool') then
- i.Parent=game.Workspace
- end
- end
- end
- function GunObject:SendBullet(boltstart, targetpos, fuzzyness, SegmentLength, ignore, clr, damage, fadedelay)
- if self.Ammo.Value <=0 then return end
- self.Ammo.Value = self.Ammo.Value - 1
- self:SpawnShell()
- self.Fire.Pitch = 1
- self.Fire:Play()
- self.Volume = 10
- self.Fire.TimePosition = 0
- self.DoFireAni.Value = not self.DoFireAni.Value
- print(self.Fire.Pitch)
- local boltdist = self.Range
- local clickdist = (boltstart - targetpos).magnitude
- local targetpos = targetpos + (Vector3.new(math.random() - .5, math.random() - .5, math.random() - .5) * (clickdist/100) * fuzzyness)
- local boltvec = (targetpos - boltstart).unit
- local totalsegments = math.ceil(boltdist/SegmentLength)
- local lastpos = boltstart
- for i = 1, totalsegments do
- local newpos = (boltstart + (boltvec * (boltdist * (i/totalsegments))))
- local segvec = (newpos - lastpos).unit
- local boltlength = (newpos - lastpos).magnitude
- local bolthit, endpos = CastRay(lastpos, segvec, boltlength, ignore, false)
- DrawBeam(lastpos, endpos, clr, fadedelay, self.LaserObj)
- if bolthit ~= nil then
- local h = bolthit.Parent:FindFirstChild("Humanoid")
- if h ~= nil then
- local plr = game.Players:GetPlayerFromCharacter(self.Tool.Parent)
- if plr ~= nil then
- local creator = Instance.new("ObjectValue")
- creator.Name = "creator"
- creator.Value = plr
- creator.Parent = h
- end
- if hit.Parent:FindFirstChild("BlockShot") then
- hit.Parent:FindFirstChild("BlockShot"):Fire(newpos)
- delay(0, function() self:HitEffect(endpos, BrickColor.new('Bright yellow'),5) end)
- else
- if(hit.Name=='Head') then
- KnockOffHats(hit.Parent)
- end
- if GoreOn then delay(0,function() self:HitEffect(endpos, BrickColor.new('Bright red'),20) end) end
- h:TakeDamage(damage)
- end
- else
- delay(0, function() self:HitEffect(endpos, BrickColor.new('Bright yellow'),5) end)
- end
- break
- end
- lastpos = endpos
- wait(Rate)
- end
- if self.Ammo.Value < 1 then
- self:Reload()
- end
- end
- function GunObject:MakeSpark(pos,tcolor)
- local effect=self.SparkEffect:Clone()
- effect.BrickColor = tcolor
- effect.CFrame = CFrame.new(pos)
- effect.Parent = game.Workspace
- local effectVel = Instance.new("BodyVelocity")
- effectVel.maxForce = Vector3.new(99999, 99999, 99999)
- effectVel.velocity = Vector3.new(math.random() * 15 * SigNum(math.random( - 10, 10)), math.random() * 15 * SigNum(math.random( - 10, 10)), math.random() * 15 * SigNum(math.random( - 10, 10)))
- effectVel.Parent = effect
- effect.Size = Vector3.new(math.abs(effectVel.velocity.x)/30, math.abs(effectVel.velocity.y)/30, math.abs(effectVel.velocity.z)/30)
- wait()
- effectVel:Destroy()
- local effecttime = .5
- game.Debris:AddItem(effect, effecttime * 2)
- local startTime = time()
- while time() - startTime < effecttime do
- if effect ~= nil then
- effect.Transparency = (time() - startTime)/effecttime
- end
- wait()
- end
- if effect ~= nil then
- effect.Parent = nil
- end
- end
- function GunObject:HitEffect(pos,tcolor,numSparks)
- for i = 0, numSparks, 1 do
- Spawn(function() self:MakeSpark(pos,tcolor) end)
- end
- end
- --[[/Member functions]]
- --[[Static functions]]
- function Round(number, decimal)
- decimal = decimal or 0
- local mult = 10^decimal
- return math.floor(number * mult + .5)/mult
- end
- function SigNum(num)
- if num == 0 then return 1 end
- return math.abs(num)/num
- end
- --this is a little bad, but shouldn't really be part of the 'class' of the gun
- local Intangibles = {shock=1, bolt=1, bullet=1, plasma=1, effect=1, laser=1, handle=1, effects=1, flash=1,}
- function CheckIntangible(hitObj)
- print(hitObj.Name)
- return Intangibles[(string.lower(hitObj.Name))] or hitObj.Transparency == 1
- end
- function CastRay(startpos, vec, length, ignore, delayifhit)
- if length > 999 then
- length = 999
- end
- hit, endpos2 = game.Workspace:FindPartOnRay(Ray.new(startpos, vec * length), ignore)
- if hit ~= nil then
- if CheckIntangible(hit) then
- if delayifhit then
- wait()
- end
- hit, endpos2 = CastRay(endpos2 + (vec * .01), vec, length - ((startpos - endpos2).magnitude), ignore, delayifhit)
- end
- end
- return hit, endpos2
- end
- function DrawBeam(beamstart, beamend, clr, fadedelay, templatePart)
- local dis = 2 --(beamstart - beamend).magnitude
- local tlaser=templatePart:Clone()
- tlaser.BrickColor = clr
- tlaser.Size = Vector3.new(.1, .1, dis + .2)
- tlaser.CFrame = CFrame.new((beamend+beamstart)/2, beamstart) * CFrame.new(0, 0, - dis/2)
- tlaser.Parent = game.Workspace
- game.Debris:AddItem(tlaser, fadedelay)
- end
- --[[/Static functions]]
- GunObject:Initialize()
- end))
- Script31.Name = "Firescript"
- Script31.Parent = Tool0
- table.insert(cors,sandbox(Script31,function()
- -- Made by Stickmasterluke
- -- edited by fusroblox
- local GoreOn=true
- function WaitForChild(parent,child)
- while not parent:FindFirstChild(child) do print("2waiting for " .. child) wait() end
- return parent[child]
- end
- local GunObject = {
- Tool = script.Parent,
- Handle = WaitForChild(script.Parent,'Handle'),
- check = true,
- GunDamage = 27, -- Base output damage per shot.
- FireRate = .7, -- How often the weapon can fire.
- Automatic = false, -- hold down to continue firing
- Range = 250, -- Max distance that the weapon can fire.
- Spread = 7, -- The bigger the spread, the more inaccurate the shots will be.
- ClipSize = 36, -- Shots in a clip
- ReloadTime = 0, -- Time it takes to reload the tool.
- StartingClips = 10, -- If you want infinit clips, remove the IntValue named "Clips" from the tool.
- SegmentLength = 40, -- How long the shot segments are, or the speed of the shot.
- FadeDelayTime = 1/30,
- BarrelPos = CFrame.new(0, 0, - 1.2), -- L, F, U
- Rate = 1/30,
- --local Colors = {BrickColor.new("Bright red"), BrickColor.new("Really red"), BrickColor.new("Dusty Rose"), BrickColor.new("Medium red")}
- Colors = {BrickColor.new("Bright yellow"),BrickColor.new("Mid gray"), BrickColor.new("Medium stone grey"), BrickColor.new("Dark stone grey")},
- FlashColors = {"Medium red", "Dusty Rose", "Bright red", "Really red"},
- Reloading = false,
- Debris = game:GetService("Debris"),
- Ammo,
- Clips,
- LaserObj,
- SparkEffect,
- ShellPart,
- --tool children
- DownVal=WaitForChild(script.Parent, 'Down'),
- AimVal=WaitForChild(script.Parent, 'Aim'),
- ReloadingVal=WaitForChild(script.Parent, 'Reloading'),
- DoFireAni = WaitForChild(script.Parent,'DoFireAni'),
- --handlechildren
- Fire,
- }
- --[[Member functions]]
- function GunObject:Initialize()
- self.Fire=WaitForChild(self.Handle, 'Fire')
- self.Ammo = self.Tool:FindFirstChild("Ammo")
- if self.Ammo ~= nil then
- self.Ammo.Value = self.ClipSize
- end
- self.Clips = self.Tool:FindFirstChild("Clips")
- if self.Clips ~= nil then
- self.Clips.Value = self.StartingClips
- end
- self.Tool.Equipped:connect(function()
- self.Tool.Handle.Fire:Stop()
- self.Tool.Handle.Reload:Stop()
- end)
- self.Tool.Unequipped:connect(function()
- self.Tool.Handle.Fire:Stop()
- self.Tool.Handle.Reload:Stop()
- end)
- self.LaserObj = Instance.new("Part")
- self.LaserObj.Name = "Bullet"
- self.LaserObj.Anchored = true
- self.LaserObj.CanCollide = false
- self.LaserObj.Shape = "Block"
- self.LaserObj.formFactor = "Custom"
- self.LaserObj.Material = Enum.Material.Neon
- self.LaserObj.Locked = true
- self.LaserObj.TopSurface = 0
- self.LaserObj.BottomSurface = 0
- local tSparkEffect = Instance.new("Part")
- tSparkEffect.Name = "Effect"
- tSparkEffect.Anchored = false
- tSparkEffect.CanCollide = false
- tSparkEffect.Shape = "Block"
- tSparkEffect.formFactor = "Custom"
- tSparkEffect.Material = Enum.Material.Neon
- tSparkEffect.Locked = true
- tSparkEffect.TopSurface = 0
- tSparkEffect.BottomSurface = 0
- self.SparkEffect=tSparkEffect
- local tshell = Instance.new('Part')
- tshell.Name='effect'
- tshell.FormFactor='Custom'
- tshell.Size=Vector3.new(1, 0.4, 0.33)
- tshell.BrickColor=BrickColor.new('Bright yellow')
- local tshellmesh=WaitForChild(script.Parent,'BulletMesh'):Clone()
- tshellmesh.Parent=tshell
- self.ShellPart = tshell
- self.DownVal.Changed:connect(function()
- while self.DownVal.Value and self.check and not self.Reloading do
- self.check = false
- local humanoid = self.Tool.Parent:FindFirstChild("Humanoid")
- local plr1 = game.Players:GetPlayerFromCharacter(self.Tool.Parent)
- if humanoid ~= nil and plr1 ~= nil then
- if humanoid.Health > 0 then
- local spos1 = (self.Tool.Handle.CFrame * self.BarrelPos).p
- delay(0, function() self:SendBullet(spos1, self.AimVal.Value, self.Spread, self.SegmentLength, self.Tool.Parent, self.Colors[1], self.GunDamage, self.FadeDelayTime) end)
- else
- self.check = true
- break
- end
- else
- self.check = true
- break
- end
- wait(self.FireRate)
- self.check = true
- if not self.Automatic then
- break
- end
- end
- end)
- self.ReloadingVal.Changed:connect(function() if self.ReloadingVal.Value then self:Reload() end end)
- end
- function GunObject:Reload()
- self.Reloading = true
- self.ReloadingVal.Value = true
- if self.Clips ~= nil then
- if self.Clips.Value > 0 then
- self.Clips.Value = Clips.Value - 1
- else
- self.Reloading = false
- self.ReloadingVal.Value = false
- return
- end
- end
- self.Tool.Handle.Reload:Play()
- for i = 1, self.ClipSize do
- wait(self.ReloadTime/self.ClipSize)
- self.Ammo.Value = i
- end
- self.Reloading = false
- self.Tool.Reloading.Value = false
- end
- function GunObject:SpawnShell()
- local tshell=self.ShellPart:Clone()
- tshell.CFrame=self.Handle.CFrame
- tshell.Parent=Workspace
- game.Debris:AddItem(tshell,2)
- end
- function KnockOffHats(tchar)
- for _,i in pairs(tchar:GetChildren()) do
- if i:IsA('Hat') then
- i.Parent=game.Workspace
- end
- end
- end
- function KnockOffTool(tchar)
- for _,i in pairs(tchar:GetChildren()) do
- if i:IsA('Tool') then
- i.Parent=game.Workspace
- end
- end
- end
- function GunObject:SendBullet(boltstart, targetpos, fuzzyness, SegmentLength, ignore, clr, damage, fadedelay)
- if self.Ammo.Value <=0 then return end
- self.Ammo.Value = self.Ammo.Value - 1
- self:SpawnShell()
- self.Fire.Pitch = 1
- self.Fire:Play()
- self.Volume = 10
- self.Fire.TimePosition = 0
- self.DoFireAni.Value = not self.DoFireAni.Value
- print(self.Fire.Pitch)
- local boltdist = self.Range
- local clickdist = (boltstart - targetpos).magnitude
- local targetpos = targetpos + (Vector3.new(math.random() - .5, math.random() - .5, math.random() - .5) * (clickdist/100) * fuzzyness)
- local boltvec = (targetpos - boltstart).unit
- local totalsegments = math.ceil(boltdist/SegmentLength)
- local lastpos = boltstart
- for i = 1, totalsegments do
- local newpos = (boltstart + (boltvec * (boltdist * (i/totalsegments))))
- local segvec = (newpos - lastpos).unit
- local boltlength = (newpos - lastpos).magnitude
- local bolthit, endpos = CastRay(lastpos, segvec, boltlength, ignore, false)
- DrawBeam(lastpos, endpos, clr, fadedelay, self.LaserObj)
- if bolthit ~= nil then
- local h = bolthit.Parent:FindFirstChild("Humanoid")
- if h ~= nil then
- local plr = game.Players:GetPlayerFromCharacter(self.Tool.Parent)
- if plr ~= nil then
- local creator = Instance.new("ObjectValue")
- creator.Name = "creator"
- creator.Value = plr
- creator.Parent = h
- end
- if hit.Parent:FindFirstChild("BlockShot") then
- hit.Parent:FindFirstChild("BlockShot"):Fire(newpos)
- delay(0, function() self:HitEffect(endpos, BrickColor.new('Bright yellow'),5) end)
- else
- if(hit.Name=='Head') then
- KnockOffHats(hit.Parent)
- end
- if GoreOn then delay(0,function() self:HitEffect(endpos, BrickColor.new('Bright red'),20) end) end
- h:TakeDamage(damage)
- end
- else
- delay(0, function() self:HitEffect(endpos, BrickColor.new('Bright yellow'),5) end)
- end
- break
- end
- lastpos = endpos
- wait(Rate)
- end
- if self.Ammo.Value < 1 then
- self:Reload()
- end
- end
- function GunObject:MakeSpark(pos,tcolor)
- local effect=self.SparkEffect:Clone()
- effect.BrickColor = tcolor
- effect.CFrame = CFrame.new(pos)
- effect.Parent = game.Workspace
- local effectVel = Instance.new("BodyVelocity")
- effectVel.maxForce = Vector3.new(99999, 99999, 99999)
- effectVel.velocity = Vector3.new(math.random() * 15 * SigNum(math.random( - 10, 10)), math.random() * 15 * SigNum(math.random( - 10, 10)), math.random() * 15 * SigNum(math.random( - 10, 10)))
- effectVel.Parent = effect
- effect.Size = Vector3.new(math.abs(effectVel.velocity.x)/30, math.abs(effectVel.velocity.y)/30, math.abs(effectVel.velocity.z)/30)
- wait()
- effectVel:Destroy()
- local effecttime = .5
- game.Debris:AddItem(effect, effecttime * 2)
- local startTime = time()
- while time() - startTime < effecttime do
- if effect ~= nil then
- effect.Transparency = (time() - startTime)/effecttime
- end
- wait()
- end
- if effect ~= nil then
- effect.Parent = nil
- end
- end
- function GunObject:HitEffect(pos,tcolor,numSparks)
- for i = 0, numSparks, 1 do
- Spawn(function() self:MakeSpark(pos,tcolor) end)
- end
- end
- --[[/Member functions]]
- --[[Static functions]]
- function Round(number, decimal)
- decimal = decimal or 0
- local mult = 10^decimal
- return math.floor(number * mult + .5)/mult
- end
- function SigNum(num)
- if num == 0 then return 1 end
- return math.abs(num)/num
- end
- --this is a little bad, but shouldn't really be part of the 'class' of the gun
- local Intangibles = {shock=1, bolt=1, bullet=1, plasma=1, effect=1, laser=1, handle=1, effects=1, flash=1,}
- function CheckIntangible(hitObj)
- print(hitObj.Name)
- return Intangibles[(string.lower(hitObj.Name))] or hitObj.Transparency == 1
- end
- function CastRay(startpos, vec, length, ignore, delayifhit)
- if length > 999 then
- length = 999
- end
- hit, endpos2 = game.Workspace:FindPartOnRay(Ray.new(startpos, vec * length), ignore)
- if hit ~= nil then
- if CheckIntangible(hit) then
- if delayifhit then
- wait()
- end
- hit, endpos2 = CastRay(endpos2 + (vec * .01), vec, length - ((startpos - endpos2).magnitude), ignore, delayifhit)
- end
- end
- return hit, endpos2
- end
- function DrawBeam(beamstart, beamend, clr, fadedelay, templatePart)
- local dis = 2 --(beamstart - beamend).magnitude
- local tlaser=templatePart:Clone()
- tlaser.BrickColor = clr
- tlaser.Size = Vector3.new(.1, .1, dis + .2)
- tlaser.CFrame = CFrame.new((beamend+beamstart)/2, beamstart) * CFrame.new(0, 0, - dis/2)
- tlaser.Parent = game.Workspace
- game.Debris:AddItem(tlaser, fadedelay)
- end
- --[[/Static functions]]
- GunObject:Initialize()
- end))
- Script32.Name = "Firescript"
- Script32.Parent = Tool0
- table.insert(cors,sandbox(Script32,function()
- -- Made by Stickmasterluke
- -- edited by fusroblox
- local GoreOn=true
- function WaitForChild(parent,child)
- while not parent:FindFirstChild(child) do print("2waiting for " .. child) wait() end
- return parent[child]
- end
- local GunObject = {
- Tool = script.Parent,
- Handle = WaitForChild(script.Parent,'Handle'),
- check = true,
- GunDamage = 27, -- Base output damage per shot.
- FireRate = .7, -- How often the weapon can fire.
- Automatic = false, -- hold down to continue firing
- Range = 250, -- Max distance that the weapon can fire.
- Spread = 7, -- The bigger the spread, the more inaccurate the shots will be.
- ClipSize = 36, -- Shots in a clip
- ReloadTime = 0, -- Time it takes to reload the tool.
- StartingClips = 10, -- If you want infinit clips, remove the IntValue named "Clips" from the tool.
- SegmentLength = 40, -- How long the shot segments are, or the speed of the shot.
- FadeDelayTime = 1/30,
- BarrelPos = CFrame.new(0, 0, - 1.2), -- L, F, U
- Rate = 1/30,
- --local Colors = {BrickColor.new("Bright red"), BrickColor.new("Really red"), BrickColor.new("Dusty Rose"), BrickColor.new("Medium red")}
- Colors = {BrickColor.new("Bright yellow"),BrickColor.new("Mid gray"), BrickColor.new("Medium stone grey"), BrickColor.new("Dark stone grey")},
- FlashColors = {"Medium red", "Dusty Rose", "Bright red", "Really red"},
- Reloading = false,
- Debris = game:GetService("Debris"),
- Ammo,
- Clips,
- LaserObj,
- SparkEffect,
- ShellPart,
- --tool children
- DownVal=WaitForChild(script.Parent, 'Down'),
- AimVal=WaitForChild(script.Parent, 'Aim'),
- ReloadingVal=WaitForChild(script.Parent, 'Reloading'),
- DoFireAni = WaitForChild(script.Parent,'DoFireAni'),
- --handlechildren
- Fire,
- }
- --[[Member functions]]
- function GunObject:Initialize()
- self.Fire=WaitForChild(self.Handle, 'Fire')
- self.Ammo = self.Tool:FindFirstChild("Ammo")
- if self.Ammo ~= nil then
- self.Ammo.Value = self.ClipSize
- end
- self.Clips = self.Tool:FindFirstChild("Clips")
- if self.Clips ~= nil then
- self.Clips.Value = self.StartingClips
- end
- self.Tool.Equipped:connect(function()
- self.Tool.Handle.Fire:Stop()
- self.Tool.Handle.Reload:Stop()
- end)
- self.Tool.Unequipped:connect(function()
- self.Tool.Handle.Fire:Stop()
- self.Tool.Handle.Reload:Stop()
- end)
- self.LaserObj = Instance.new("Part")
- self.LaserObj.Name = "Bullet"
- self.LaserObj.Anchored = true
- self.LaserObj.CanCollide = false
- self.LaserObj.Shape = "Block"
- self.LaserObj.formFactor = "Custom"
- self.LaserObj.Material = Enum.Material.Neon
- self.LaserObj.Locked = true
- self.LaserObj.TopSurface = 0
- self.LaserObj.BottomSurface = 0
- local tSparkEffect = Instance.new("Part")
- tSparkEffect.Name = "Effect"
- tSparkEffect.Anchored = false
- tSparkEffect.CanCollide = false
- tSparkEffect.Shape = "Block"
- tSparkEffect.formFactor = "Custom"
- tSparkEffect.Material = Enum.Material.Neon
- tSparkEffect.Locked = true
- tSparkEffect.TopSurface = 0
- tSparkEffect.BottomSurface = 0
- self.SparkEffect=tSparkEffect
- local tshell = Instance.new('Part')
- tshell.Name='effect'
- tshell.FormFactor='Custom'
- tshell.Size=Vector3.new(1, 0.4, 0.33)
- tshell.BrickColor=BrickColor.new('Bright yellow')
- local tshellmesh=WaitForChild(script.Parent,'BulletMesh'):Clone()
- tshellmesh.Parent=tshell
- self.ShellPart = tshell
- self.DownVal.Changed:connect(function()
- while self.DownVal.Value and self.check and not self.Reloading do
- self.check = false
- local humanoid = self.Tool.Parent:FindFirstChild("Humanoid")
- local plr1 = game.Players:GetPlayerFromCharacter(self.Tool.Parent)
- if humanoid ~= nil and plr1 ~= nil then
- if humanoid.Health > 0 then
- local spos1 = (self.Tool.Handle.CFrame * self.BarrelPos).p
- delay(0, function() self:SendBullet(spos1, self.AimVal.Value, self.Spread, self.SegmentLength, self.Tool.Parent, self.Colors[1], self.GunDamage, self.FadeDelayTime) end)
- else
- self.check = true
- break
- end
- else
- self.check = true
- break
- end
- wait(self.FireRate)
- self.check = true
- if not self.Automatic then
- break
- end
- end
- end)
- self.ReloadingVal.Changed:connect(function() if self.ReloadingVal.Value then self:Reload() end end)
- end
- function GunObject:Reload()
- self.Reloading = true
- self.ReloadingVal.Value = true
- if self.Clips ~= nil then
- if self.Clips.Value > 0 then
- self.Clips.Value = Clips.Value - 1
- else
- self.Reloading = false
- self.ReloadingVal.Value = false
- return
- end
- end
- self.Tool.Handle.Reload:Play()
- for i = 1, self.ClipSize do
- wait(self.ReloadTime/self.ClipSize)
- self.Ammo.Value = i
- end
- self.Reloading = false
- self.Tool.Reloading.Value = false
- end
- function GunObject:SpawnShell()
- local tshell=self.ShellPart:Clone()
- tshell.CFrame=self.Handle.CFrame
- tshell.Parent=Workspace
- game.Debris:AddItem(tshell,2)
- end
- function KnockOffHats(tchar)
- for _,i in pairs(tchar:GetChildren()) do
- if i:IsA('Hat') then
- i.Parent=game.Workspace
- end
- end
- end
- function KnockOffTool(tchar)
- for _,i in pairs(tchar:GetChildren()) do
- if i:IsA('Tool') then
- i.Parent=game.Workspace
- end
- end
- end
- function GunObject:SendBullet(boltstart, targetpos, fuzzyness, SegmentLength, ignore, clr, damage, fadedelay)
- if self.Ammo.Value <=0 then return end
- self.Ammo.Value = self.Ammo.Value - 1
- self:SpawnShell()
- self.Fire.Pitch = 1
- self.Fire:Play()
- self.Volume = 10
- self.Fire.TimePosition = 0
- self.DoFireAni.Value = not self.DoFireAni.Value
- print(self.Fire.Pitch)
- local boltdist = self.Range
- local clickdist = (boltstart - targetpos).magnitude
- local targetpos = targetpos + (Vector3.new(math.random() - .5, math.random() - .5, math.random() - .5) * (clickdist/100) * fuzzyness)
- local boltvec = (targetpos - boltstart).unit
- local totalsegments = math.ceil(boltdist/SegmentLength)
- local lastpos = boltstart
- for i = 1, totalsegments do
- local newpos = (boltstart + (boltvec * (boltdist * (i/totalsegments))))
- local segvec = (newpos - lastpos).unit
- local boltlength = (newpos - lastpos).magnitude
- local bolthit, endpos = CastRay(lastpos, segvec, boltlength, ignore, false)
- DrawBeam(lastpos, endpos, clr, fadedelay, self.LaserObj)
- if bolthit ~= nil then
- local h = bolthit.Parent:FindFirstChild("Humanoid")
- if h ~= nil then
- local plr = game.Players:GetPlayerFromCharacter(self.Tool.Parent)
- if plr ~= nil then
- local creator = Instance.new("ObjectValue")
- creator.Name = "creator"
- creator.Value = plr
- creator.Parent = h
- end
- if hit.Parent:FindFirstChild("BlockShot") then
- hit.Parent:FindFirstChild("BlockShot"):Fire(newpos)
- delay(0, function() self:HitEffect(endpos, BrickColor.new('Bright yellow'),5) end)
- else
- if(hit.Name=='Head') then
- KnockOffHats(hit.Parent)
- end
- if GoreOn then delay(0,function() self:HitEffect(endpos, BrickColor.new('Bright red'),20) end) end
- h:TakeDamage(damage)
- end
- else
- delay(0, function() self:HitEffect(endpos, BrickColor.new('Bright yellow'),5) end)
- end
- break
- end
- lastpos = endpos
- wait(Rate)
- end
- if self.Ammo.Value < 1 then
- self:Reload()
- end
- end
- function GunObject:MakeSpark(pos,tcolor)
- local effect=self.SparkEffect:Clone()
- effect.BrickColor = tcolor
- effect.CFrame = CFrame.new(pos)
- effect.Parent = game.Workspace
- local effectVel = Instance.new("BodyVelocity")
- effectVel.maxForce = Vector3.new(99999, 99999, 99999)
- effectVel.velocity = Vector3.new(math.random() * 15 * SigNum(math.random( - 10, 10)), math.random() * 15 * SigNum(math.random( - 10, 10)), math.random() * 15 * SigNum(math.random( - 10, 10)))
- effectVel.Parent = effect
- effect.Size = Vector3.new(math.abs(effectVel.velocity.x)/30, math.abs(effectVel.velocity.y)/30, math.abs(effectVel.velocity.z)/30)
- wait()
- effectVel:Destroy()
- local effecttime = .5
- game.Debris:AddItem(effect, effecttime * 2)
- local startTime = time()
- while time() - startTime < effecttime do
- if effect ~= nil then
- effect.Transparency = (time() - startTime)/effecttime
- end
- wait()
- end
- if effect ~= nil then
- effect.Parent = nil
- end
- end
- function GunObject:HitEffect(pos,tcolor,numSparks)
- for i = 0, numSparks, 1 do
- Spawn(function() self:MakeSpark(pos,tcolor) end)
- end
- end
- --[[/Member functions]]
- --[[Static functions]]
- function Round(number, decimal)
- decimal = decimal or 0
- local mult = 10^decimal
- return math.floor(number * mult + .5)/mult
- end
- function SigNum(num)
- if num == 0 then return 1 end
- return math.abs(num)/num
- end
- --this is a little bad, but shouldn't really be part of the 'class' of the gun
- local Intangibles = {shock=1, bolt=1, bullet=1, plasma=1, effect=1, laser=1, handle=1, effects=1, flash=1,}
- function CheckIntangible(hitObj)
- print(hitObj.Name)
- return Intangibles[(string.lower(hitObj.Name))] or hitObj.Transparency == 1
- end
- function CastRay(startpos, vec, length, ignore, delayifhit)
- if length > 999 then
- length = 999
- end
- hit, endpos2 = game.Workspace:FindPartOnRay(Ray.new(startpos, vec * length), ignore)
- if hit ~= nil then
- if CheckIntangible(hit) then
- if delayifhit then
- wait()
- end
- hit, endpos2 = CastRay(endpos2 + (vec * .01), vec, length - ((startpos - endpos2).magnitude), ignore, delayifhit)
- end
- end
- return hit, endpos2
- end
- function DrawBeam(beamstart, beamend, clr, fadedelay, templatePart)
- local dis = 2 --(beamstart - beamend).magnitude
- local tlaser=templatePart:Clone()
- tlaser.BrickColor = clr
- tlaser.Size = Vector3.new(.1, .1, dis + .2)
- tlaser.CFrame = CFrame.new((beamend+beamstart)/2, beamstart) * CFrame.new(0, 0, - dis/2)
- tlaser.Parent = game.Workspace
- game.Debris:AddItem(tlaser, fadedelay)
- end
- --[[/Static functions]]
- GunObject:Initialize()
- end))
- Script33.Name = "Firescript"
- Script33.Parent = Tool0
- table.insert(cors,sandbox(Script33,function()
- -- Made by Stickmasterluke
- -- edited by fusroblox
- local GoreOn=true
- function WaitForChild(parent,child)
- while not parent:FindFirstChild(child) do print("2waiting for " .. child) wait() end
- return parent[child]
- end
- local GunObject = {
- Tool = script.Parent,
- Handle = WaitForChild(script.Parent,'Handle'),
- check = true,
- GunDamage = 27, -- Base output damage per shot.
- FireRate = .7, -- How often the weapon can fire.
- Automatic = false, -- hold down to continue firing
- Range = 250, -- Max distance that the weapon can fire.
- Spread = 7, -- The bigger the spread, the more inaccurate the shots will be.
- ClipSize = 36, -- Shots in a clip
- ReloadTime = 0, -- Time it takes to reload the tool.
- StartingClips = 10, -- If you want infinit clips, remove the IntValue named "Clips" from the tool.
- SegmentLength = 40, -- How long the shot segments are, or the speed of the shot.
- FadeDelayTime = 1/30,
- BarrelPos = CFrame.new(0, 0, - 1.2), -- L, F, U
- Rate = 1/30,
- --local Colors = {BrickColor.new("Bright red"), BrickColor.new("Really red"), BrickColor.new("Dusty Rose"), BrickColor.new("Medium red")}
- Colors = {BrickColor.new("Bright yellow"),BrickColor.new("Mid gray"), BrickColor.new("Medium stone grey"), BrickColor.new("Dark stone grey")},
- FlashColors = {"Medium red", "Dusty Rose", "Bright red", "Really red"},
- Reloading = false,
- Debris = game:GetService("Debris"),
- Ammo,
- Clips,
- LaserObj,
- SparkEffect,
- ShellPart,
- --tool children
- DownVal=WaitForChild(script.Parent, 'Down'),
- AimVal=WaitForChild(script.Parent, 'Aim'),
- ReloadingVal=WaitForChild(script.Parent, 'Reloading'),
- DoFireAni = WaitForChild(script.Parent,'DoFireAni'),
- --handlechildren
- Fire,
- }
- --[[Member functions]]
- function GunObject:Initialize()
- self.Fire=WaitForChild(self.Handle, 'Fire')
- self.Ammo = self.Tool:FindFirstChild("Ammo")
- if self.Ammo ~= nil then
- self.Ammo.Value = self.ClipSize
- end
- self.Clips = self.Tool:FindFirstChild("Clips")
- if self.Clips ~= nil then
- self.Clips.Value = self.StartingClips
- end
- self.Tool.Equipped:connect(function()
- self.Tool.Handle.Fire:Stop()
- self.Tool.Handle.Reload:Stop()
- end)
- self.Tool.Unequipped:connect(function()
- self.Tool.Handle.Fire:Stop()
- self.Tool.Handle.Reload:Stop()
- end)
- self.LaserObj = Instance.new("Part")
- self.LaserObj.Name = "Bullet"
- self.LaserObj.Anchored = true
- self.LaserObj.CanCollide = false
- self.LaserObj.Shape = "Block"
- self.LaserObj.formFactor = "Custom"
- self.LaserObj.Material = Enum.Material.Neon
- self.LaserObj.Locked = true
- self.LaserObj.TopSurface = 0
- self.LaserObj.BottomSurface = 0
- local tSparkEffect = Instance.new("Part")
- tSparkEffect.Name = "Effect"
- tSparkEffect.Anchored = false
- tSparkEffect.CanCollide = false
- tSparkEffect.Shape = "Block"
- tSparkEffect.formFactor = "Custom"
- tSparkEffect.Material = Enum.Material.Neon
- tSparkEffect.Locked = true
- tSparkEffect.TopSurface = 0
- tSparkEffect.BottomSurface = 0
- self.SparkEffect=tSparkEffect
- local tshell = Instance.new('Part')
- tshell.Name='effect'
- tshell.FormFactor='Custom'
- tshell.Size=Vector3.new(1, 0.4, 0.33)
- tshell.BrickColor=BrickColor.new('Bright yellow')
- local tshellmesh=WaitForChild(script.Parent,'BulletMesh'):Clone()
- tshellmesh.Parent=tshell
- self.ShellPart = tshell
- self.DownVal.Changed:connect(function()
- while self.DownVal.Value and self.check and not self.Reloading do
- self.check = false
- local humanoid = self.Tool.Parent:FindFirstChild("Humanoid")
- local plr1 = game.Players:GetPlayerFromCharacter(self.Tool.Parent)
- if humanoid ~= nil and plr1 ~= nil then
- if humanoid.Health > 0 then
- local spos1 = (self.Tool.Handle.CFrame * self.BarrelPos).p
- delay(0, function() self:SendBullet(spos1, self.AimVal.Value, self.Spread, self.SegmentLength, self.Tool.Parent, self.Colors[1], self.GunDamage, self.FadeDelayTime) end)
- else
- self.check = true
- break
- end
- else
- self.check = true
- break
- end
- wait(self.FireRate)
- self.check = true
- if not self.Automatic then
- break
- end
- end
- end)
- self.ReloadingVal.Changed:connect(function() if self.ReloadingVal.Value then self:Reload() end end)
- end
- function GunObject:Reload()
- self.Reloading = true
- self.ReloadingVal.Value = true
- if self.Clips ~= nil then
- if self.Clips.Value > 0 then
- self.Clips.Value = Clips.Value - 1
- else
- self.Reloading = false
- self.ReloadingVal.Value = false
- return
- end
- end
- self.Tool.Handle.Reload:Play()
- for i = 1, self.ClipSize do
- wait(self.ReloadTime/self.ClipSize)
- self.Ammo.Value = i
- end
- self.Reloading = false
- self.Tool.Reloading.Value = false
- end
- function GunObject:SpawnShell()
- local tshell=self.ShellPart:Clone()
- tshell.CFrame=self.Handle.CFrame
- tshell.Parent=Workspace
- game.Debris:AddItem(tshell,2)
- end
- function KnockOffHats(tchar)
- for _,i in pairs(tchar:GetChildren()) do
- if i:IsA('Hat') then
- i.Parent=game.Workspace
- end
- end
- end
- function KnockOffTool(tchar)
- for _,i in pairs(tchar:GetChildren()) do
- if i:IsA('Tool') then
- i.Parent=game.Workspace
- end
- end
- end
- function GunObject:SendBullet(boltstart, targetpos, fuzzyness, SegmentLength, ignore, clr, damage, fadedelay)
- if self.Ammo.Value <=0 then return end
- self.Ammo.Value = self.Ammo.Value - 1
- self:SpawnShell()
- self.Fire.Pitch = 1
- self.Fire:Play()
- self.Volume = 10
- self.Fire.TimePosition = 0
- self.DoFireAni.Value = not self.DoFireAni.Value
- print(self.Fire.Pitch)
- local boltdist = self.Range
- local clickdist = (boltstart - targetpos).magnitude
- local targetpos = targetpos + (Vector3.new(math.random() - .5, math.random() - .5, math.random() - .5) * (clickdist/100) * fuzzyness)
- local boltvec = (targetpos - boltstart).unit
- local totalsegments = math.ceil(boltdist/SegmentLength)
- local lastpos = boltstart
- for i = 1, totalsegments do
- local newpos = (boltstart + (boltvec * (boltdist * (i/totalsegments))))
- local segvec = (newpos - lastpos).unit
- local boltlength = (newpos - lastpos).magnitude
- local bolthit, endpos = CastRay(lastpos, segvec, boltlength, ignore, false)
- DrawBeam(lastpos, endpos, clr, fadedelay, self.LaserObj)
- if bolthit ~= nil then
- local h = bolthit.Parent:FindFirstChild("Humanoid")
- if h ~= nil then
- local plr = game.Players:GetPlayerFromCharacter(self.Tool.Parent)
- if plr ~= nil then
- local creator = Instance.new("ObjectValue")
- creator.Name = "creator"
- creator.Value = plr
- creator.Parent = h
- end
- if hit.Parent:FindFirstChild("BlockShot") then
- hit.Parent:FindFirstChild("BlockShot"):Fire(newpos)
- delay(0, function() self:HitEffect(endpos, BrickColor.new('Bright yellow'),5) end)
- else
- if(hit.Name=='Head') then
- KnockOffHats(hit.Parent)
- end
- if GoreOn then delay(0,function() self:HitEffect(endpos, BrickColor.new('Bright red'),20) end) end
- h:TakeDamage(damage)
- end
- else
- delay(0, function() self:HitEffect(endpos, BrickColor.new('Bright yellow'),5) end)
- end
- break
- end
- lastpos = endpos
- wait(Rate)
- end
- if self.Ammo.Value < 1 then
- self:Reload()
- end
- end
- function GunObject:MakeSpark(pos,tcolor)
- local effect=self.SparkEffect:Clone()
- effect.BrickColor = tcolor
- effect.CFrame = CFrame.new(pos)
- effect.Parent = game.Workspace
- local effectVel = Instance.new("BodyVelocity")
- effectVel.maxForce = Vector3.new(99999, 99999, 99999)
- effectVel.velocity = Vector3.new(math.random() * 15 * SigNum(math.random( - 10, 10)), math.random() * 15 * SigNum(math.random( - 10, 10)), math.random() * 15 * SigNum(math.random( - 10, 10)))
- effectVel.Parent = effect
- effect.Size = Vector3.new(math.abs(effectVel.velocity.x)/30, math.abs(effectVel.velocity.y)/30, math.abs(effectVel.velocity.z)/30)
- wait()
- effectVel:Destroy()
- local effecttime = .5
- game.Debris:AddItem(effect, effecttime * 2)
- local startTime = time()
- while time() - startTime < effecttime do
- if effect ~= nil then
- effect.Transparency = (time() - startTime)/effecttime
- end
- wait()
- end
- if effect ~= nil then
- effect.Parent = nil
- end
- end
- function GunObject:HitEffect(pos,tcolor,numSparks)
- for i = 0, numSparks, 1 do
- Spawn(function() self:MakeSpark(pos,tcolor) end)
- end
- end
- --[[/Member functions]]
- --[[Static functions]]
- function Round(number, decimal)
- decimal = decimal or 0
- local mult = 10^decimal
- return math.floor(number * mult + .5)/mult
- end
- function SigNum(num)
- if num == 0 then return 1 end
- return math.abs(num)/num
- end
- --this is a little bad, but shouldn't really be part of the 'class' of the gun
- local Intangibles = {shock=1, bolt=1, bullet=1, plasma=1, effect=1, laser=1, handle=1, effects=1, flash=1,}
- function CheckIntangible(hitObj)
- print(hitObj.Name)
- return Intangibles[(string.lower(hitObj.Name))] or hitObj.Transparency == 1
- end
- function CastRay(startpos, vec, length, ignore, delayifhit)
- if length > 999 then
- length = 999
- end
- hit, endpos2 = game.Workspace:FindPartOnRay(Ray.new(startpos, vec * length), ignore)
- if hit ~= nil then
- if CheckIntangible(hit) then
- if delayifhit then
- wait()
- end
- hit, endpos2 = CastRay(endpos2 + (vec * .01), vec, length - ((startpos - endpos2).magnitude), ignore, delayifhit)
- end
- end
- return hit, endpos2
- end
- function DrawBeam(beamstart, beamend, clr, fadedelay, templatePart)
- local dis = 2 --(beamstart - beamend).magnitude
- local tlaser=templatePart:Clone()
- tlaser.BrickColor = clr
- tlaser.Size = Vector3.new(.1, .1, dis + .2)
- tlaser.CFrame = CFrame.new((beamend+beamstart)/2, beamstart) * CFrame.new(0, 0, - dis/2)
- tlaser.Parent = game.Workspace
- game.Debris:AddItem(tlaser, fadedelay)
- end
- --[[/Static functions]]
- GunObject:Initialize()
- end))
- Script34.Name = "Firescript"
- Script34.Parent = Tool0
- table.insert(cors,sandbox(Script34,function()
- -- Made by Stickmasterluke
- -- edited by fusroblox
- local GoreOn=true
- function WaitForChild(parent,child)
- while not parent:FindFirstChild(child) do print("2waiting for " .. child) wait() end
- return parent[child]
- end
- local GunObject = {
- Tool = script.Parent,
- Handle = WaitForChild(script.Parent,'Handle'),
- check = true,
- GunDamage = 27, -- Base output damage per shot.
- FireRate = .7, -- How often the weapon can fire.
- Automatic = false, -- hold down to continue firing
- Range = 250, -- Max distance that the weapon can fire.
- Spread = 7, -- The bigger the spread, the more inaccurate the shots will be.
- ClipSize = 36, -- Shots in a clip
- ReloadTime = 0, -- Time it takes to reload the tool.
- StartingClips = 10, -- If you want infinit clips, remove the IntValue named "Clips" from the tool.
- SegmentLength = 40, -- How long the shot segments are, or the speed of the shot.
- FadeDelayTime = 1/30,
- BarrelPos = CFrame.new(0, 0, - 1.2), -- L, F, U
- Rate = 1/30,
- --local Colors = {BrickColor.new("Bright red"), BrickColor.new("Really red"), BrickColor.new("Dusty Rose"), BrickColor.new("Medium red")}
- Colors = {BrickColor.new("Bright yellow"),BrickColor.new("Mid gray"), BrickColor.new("Medium stone grey"), BrickColor.new("Dark stone grey")},
- FlashColors = {"Medium red", "Dusty Rose", "Bright red", "Really red"},
- Reloading = false,
- Debris = game:GetService("Debris"),
- Ammo,
- Clips,
- LaserObj,
- SparkEffect,
- ShellPart,
- --tool children
- DownVal=WaitForChild(script.Parent, 'Down'),
- AimVal=WaitForChild(script.Parent, 'Aim'),
- ReloadingVal=WaitForChild(script.Parent, 'Reloading'),
- DoFireAni = WaitForChild(script.Parent,'DoFireAni'),
- --handlechildren
- Fire,
- }
- --[[Member functions]]
- function GunObject:Initialize()
- self.Fire=WaitForChild(self.Handle, 'Fire')
- self.Ammo = self.Tool:FindFirstChild("Ammo")
- if self.Ammo ~= nil then
- self.Ammo.Value = self.ClipSize
- end
- self.Clips = self.Tool:FindFirstChild("Clips")
- if self.Clips ~= nil then
- self.Clips.Value = self.StartingClips
- end
- self.Tool.Equipped:connect(function()
- self.Tool.Handle.Fire:Stop()
- self.Tool.Handle.Reload:Stop()
- end)
- self.Tool.Unequipped:connect(function()
- self.Tool.Handle.Fire:Stop()
- self.Tool.Handle.Reload:Stop()
- end)
- self.LaserObj = Instance.new("Part")
- self.LaserObj.Name = "Bullet"
- self.LaserObj.Anchored = true
- self.LaserObj.CanCollide = false
- self.LaserObj.Shape = "Block"
- self.LaserObj.formFactor = "Custom"
- self.LaserObj.Material = Enum.Material.Neon
- self.LaserObj.Locked = true
- self.LaserObj.TopSurface = 0
- self.LaserObj.BottomSurface = 0
- local tSparkEffect = Instance.new("Part")
- tSparkEffect.Name = "Effect"
- tSparkEffect.Anchored = false
- tSparkEffect.CanCollide = false
- tSparkEffect.Shape = "Block"
- tSparkEffect.formFactor = "Custom"
- tSparkEffect.Material = Enum.Material.Neon
- tSparkEffect.Locked = true
- tSparkEffect.TopSurface = 0
- tSparkEffect.BottomSurface = 0
- self.SparkEffect=tSparkEffect
- local tshell = Instance.new('Part')
- tshell.Name='effect'
- tshell.FormFactor='Custom'
- tshell.Size=Vector3.new(1, 0.4, 0.33)
- tshell.BrickColor=BrickColor.new('Bright yellow')
- local tshellmesh=WaitForChild(script.Parent,'BulletMesh'):Clone()
- tshellmesh.Parent=tshell
- self.ShellPart = tshell
- self.DownVal.Changed:connect(function()
- while self.DownVal.Value and self.check and not self.Reloading do
- self.check = false
- local humanoid = self.Tool.Parent:FindFirstChild("Humanoid")
- local plr1 = game.Players:GetPlayerFromCharacter(self.Tool.Parent)
- if humanoid ~= nil and plr1 ~= nil then
- if humanoid.Health > 0 then
- local spos1 = (self.Tool.Handle.CFrame * self.BarrelPos).p
- delay(0, function() self:SendBullet(spos1, self.AimVal.Value, self.Spread, self.SegmentLength, self.Tool.Parent, self.Colors[1], self.GunDamage, self.FadeDelayTime) end)
- else
- self.check = true
- break
- end
- else
- self.check = true
- break
- end
- wait(self.FireRate)
- self.check = true
- if not self.Automatic then
- break
- end
- end
- end)
- self.ReloadingVal.Changed:connect(function() if self.ReloadingVal.Value then self:Reload() end end)
- end
- function GunObject:Reload()
- self.Reloading = true
- self.ReloadingVal.Value = true
- if self.Clips ~= nil then
- if self.Clips.Value > 0 then
- self.Clips.Value = Clips.Value - 1
- else
- self.Reloading = false
- self.ReloadingVal.Value = false
- return
- end
- end
- self.Tool.Handle.Reload:Play()
- for i = 1, self.ClipSize do
- wait(self.ReloadTime/self.ClipSize)
- self.Ammo.Value = i
- end
- self.Reloading = false
- self.Tool.Reloading.Value = false
- end
- function GunObject:SpawnShell()
- local tshell=self.ShellPart:Clone()
- tshell.CFrame=self.Handle.CFrame
- tshell.Parent=Workspace
- game.Debris:AddItem(tshell,2)
- end
- function KnockOffHats(tchar)
- for _,i in pairs(tchar:GetChildren()) do
- if i:IsA('Hat') then
- i.Parent=game.Workspace
- end
- end
- end
- function KnockOffTool(tchar)
- for _,i in pairs(tchar:GetChildren()) do
- if i:IsA('Tool') then
- i.Parent=game.Workspace
- end
- end
- end
- function GunObject:SendBullet(boltstart, targetpos, fuzzyness, SegmentLength, ignore, clr, damage, fadedelay)
- if self.Ammo.Value <=0 then return end
- self.Ammo.Value = self.Ammo.Value - 1
- self:SpawnShell()
- self.Fire.Pitch = 1
- self.Fire:Play()
- self.Volume = 10
- self.Fire.TimePosition = 0
- self.DoFireAni.Value = not self.DoFireAni.Value
- print(self.Fire.Pitch)
- local boltdist = self.Range
- local clickdist = (boltstart - targetpos).magnitude
- local targetpos = targetpos + (Vector3.new(math.random() - .5, math.random() - .5, math.random() - .5) * (clickdist/100) * fuzzyness)
- local boltvec = (targetpos - boltstart).unit
- local totalsegments = math.ceil(boltdist/SegmentLength)
- local lastpos = boltstart
- for i = 1, totalsegments do
- local newpos = (boltstart + (boltvec * (boltdist * (i/totalsegments))))
- local segvec = (newpos - lastpos).unit
- local boltlength = (newpos - lastpos).magnitude
- local bolthit, endpos = CastRay(lastpos, segvec, boltlength, ignore, false)
- DrawBeam(lastpos, endpos, clr, fadedelay, self.LaserObj)
- if bolthit ~= nil then
- local h = bolthit.Parent:FindFirstChild("Humanoid")
- if h ~= nil then
- local plr = game.Players:GetPlayerFromCharacter(self.Tool.Parent)
- if plr ~= nil then
- local creator = Instance.new("ObjectValue")
- creator.Name = "creator"
- creator.Value = plr
- creator.Parent = h
- end
- if hit.Parent:FindFirstChild("BlockShot") then
- hit.Parent:FindFirstChild("BlockShot"):Fire(newpos)
- delay(0, function() self:HitEffect(endpos, BrickColor.new('Bright yellow'),5) end)
- else
- if(hit.Name=='Head') then
- KnockOffHats(hit.Parent)
- end
- if GoreOn then delay(0,function() self:HitEffect(endpos, BrickColor.new('Bright red'),20) end) end
- h:TakeDamage(damage)
- end
- else
- delay(0, function() self:HitEffect(endpos, BrickColor.new('Bright yellow'),5) end)
- end
- break
- end
- lastpos = endpos
- wait(Rate)
- end
- if self.Ammo.Value < 1 then
- self:Reload()
- end
- end
- function GunObject:MakeSpark(pos,tcolor)
- local effect=self.SparkEffect:Clone()
- effect.BrickColor = tcolor
- effect.CFrame = CFrame.new(pos)
- effect.Parent = game.Workspace
- local effectVel = Instance.new("BodyVelocity")
- effectVel.maxForce = Vector3.new(99999, 99999, 99999)
- effectVel.velocity = Vector3.new(math.random() * 15 * SigNum(math.random( - 10, 10)), math.random() * 15 * SigNum(math.random( - 10, 10)), math.random() * 15 * SigNum(math.random( - 10, 10)))
- effectVel.Parent = effect
- effect.Size = Vector3.new(math.abs(effectVel.velocity.x)/30, math.abs(effectVel.velocity.y)/30, math.abs(effectVel.velocity.z)/30)
- wait()
- effectVel:Destroy()
- local effecttime = .5
- game.Debris:AddItem(effect, effecttime * 2)
- local startTime = time()
- while time() - startTime < effecttime do
- if effect ~= nil then
- effect.Transparency = (time() - startTime)/effecttime
- end
- wait()
- end
- if effect ~= nil then
- effect.Parent = nil
- end
- end
- function GunObject:HitEffect(pos,tcolor,numSparks)
- for i = 0, numSparks, 1 do
- Spawn(function() self:MakeSpark(pos,tcolor) end)
- end
- end
- --[[/Member functions]]
- --[[Static functions]]
- function Round(number, decimal)
- decimal = decimal or 0
- local mult = 10^decimal
- return math.floor(number * mult + .5)/mult
- end
- function SigNum(num)
- if num == 0 then return 1 end
- return math.abs(num)/num
- end
- --this is a little bad, but shouldn't really be part of the 'class' of the gun
- local Intangibles = {shock=1, bolt=1, bullet=1, plasma=1, effect=1, laser=1, handle=1, effects=1, flash=1,}
- function CheckIntangible(hitObj)
- print(hitObj.Name)
- return Intangibles[(string.lower(hitObj.Name))] or hitObj.Transparency == 1
- end
- function CastRay(startpos, vec, length, ignore, delayifhit)
- if length > 999 then
- length = 999
- end
- hit, endpos2 = game.Workspace:FindPartOnRay(Ray.new(startpos, vec * length), ignore)
- if hit ~= nil then
- if CheckIntangible(hit) then
- if delayifhit then
- wait()
- end
- hit, endpos2 = CastRay(endpos2 + (vec * .01), vec, length - ((startpos - endpos2).magnitude), ignore, delayifhit)
- end
- end
- return hit, endpos2
- end
- function DrawBeam(beamstart, beamend, clr, fadedelay, templatePart)
- local dis = 2 --(beamstart - beamend).magnitude
- local tlaser=templatePart:Clone()
- tlaser.BrickColor = clr
- tlaser.Size = Vector3.new(.1, .1, dis + .2)
- tlaser.CFrame = CFrame.new((beamend+beamstart)/2, beamstart) * CFrame.new(0, 0, - dis/2)
- tlaser.Parent = game.Workspace
- game.Debris:AddItem(tlaser, fadedelay)
- end
- --[[/Static functions]]
- GunObject:Initialize()
- end))
- LocalScript35.Name = "BackGun"
- LocalScript35.Parent = Tool0
- table.insert(cors,sandbox(LocalScript35,function()
- --made by alextomcool!!!---Edited by Sparttan.
- --to use: put in type of gun: barrel point left, barrel point right or bull-pup(main hande is in the middle of the gun)
- --step 2: put in what type of wepoan it is: assult rifle or pistol(there will be more)
- --to do list: make it easyer to modife how it weld's.
- guntype = 1--1 is assult rifle, 2 is bullpup, 3 is pistol, 4 is knife
- weldmode = 3--1 is barrel point upper-left, 2 is barrel pointing upper-right, 3 is barrel point lower-left and 4 is barrel point lower-right
- -------(note: if it is pistol or knife then 1 is on right leg, 2 is on left leg, 3 is in the back of your pants and 4 is in the front of your pants)
- model = nil--gun model, that is
- distance = 0.75--this is the distance between the part(torso/leg) and the gun. DON'T MAKE negitive
- rotation = 45--this is the turning in degrees.
- --this area is mode more for someone who's already good at gun's. please do not get mad at me if you don't understand what's under here
- y = 0--this is what's added to the current y value. positive number's make it go down. negative make's it go up
- x = 0--this is what's added to the x value(it's really the z value but it look's like the x value when on your back). positive number's make it go left. negative make's it go right
- -------------------------------------------------------------------------------------------------------------------------------------------------------------------
- --I suggest not doing anything else under here. All you should have to change is the weldmode and guntype.
- --guntype 1 and weldmode 1 is for assault. guntype 3 and weldmode 1 is pistol position.
- --Those are what I have done so far so give me time so I can edit them into the correct position.
- -------------------------------------------------------------------------------------------------------------------------------------------------------------------
- parts = {}
- local n = 1
- --can i have my
- function on(mouse)
- if model == nil then
- n = 1
- local m = Instance.new("Model")
- local all = script.Parent:GetChildren()
- for i = 1, #all do
- if all[i].className == "Part" then
- parts[n] = all[i].Transparency
- local brick = all[i]:clone()
- brick.Parent = m
- n = n +1
- end
- end
- wait()
- if model == nil then
- local weld = script:FindFirstChild("Weld2")
- if weld ~= nil then
- local new = weld:clone()
- new.Disabled = false
- new.Parent = m
- m.Name = script.Parent.Name
- m.Parent = script.Parent.Parent
- model = m
- local handle = model:FindFirstChild("Handle")
- if handle ~= nil then
- --------------------------------------------------------------------------------
- --------------------------------------------------------------------------------
- --------------------------------------------------------------------------------
- --------------------------------------------------------------------------------
- --------------------------------------------------------------------------------
- if guntype == 1 then
- local torso = model.Parent:FindFirstChild("Torso")
- if torso ~= nil then
- if weldmode == 1 then--barrel pointing upper-right
- local w = Instance.new("Weld")
- w.Part0 = torso
- w.Parent = w.Part0
- w.Part1 = handle
- w.C1 = CFrame.new(distance *-1, 0.25 +y, -0.75 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation *-1), (math.pi / 2), 0)
- elseif weldmode == 2 then--barrel pointing upper-left
- local w = Instance.new("Weld")
- w.Part0 = torso
- w.Parent = w.Part0
- w.Part1 = handle
- w.C1 = CFrame.new(distance, 0.25 +y, -0.75 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation *-1), (math.pi / 2 ) *-1, 0)
- elseif weldmode == 3 then--barrel pointing upside-right
- local w = Instance.new("Weld")
- w.Part0 = torso
- w.Parent = w.Part0
- w.Part1 = handle
- w.C1 = CFrame.new(distance *-1, -0.1+y, 0.2 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation), (math.pi / 2), -1.5)
- elseif weldmode == 4 then--barrel pointing upside-left
- local w = Instance.new("Weld")
- w.Part0 = torso
- w.Parent = w.Part0
- w.Part1 = handle
- w.C1 = CFrame.new(distance, 0.25+y, -0.75 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation), (math.pi / 2 +rotation) *-1.1, 1)
- end
- end
- --------------------------------------------------------------------------------
- --------------------------------------------------------------------------------
- --------------------------------------------------------------------------------
- --------------------------------------------------------------------------------
- --------------------------------------------------------------------------------
- elseif guntype == 2 then--BullPup
- local torso = model.Parent:FindFirstChild("Torso")
- if torso ~= nil then
- if weldmode == 1 then--barrel pointing upper-right
- local w = Instance.new("Weld")
- w.Part0 = torso
- w.Parent = w.Part0
- w.Part1 = handle
- w.C1 = CFrame.new(distance *-1, 0.25+y, -0.5 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation *-1), math.pi / 2, 0)
- elseif weldmode == 2 then--barrel pointing upper-left
- local w = Instance.new("Weld")
- w.Part0 = torso
- w.Parent = w.Part0
- w.Part1 = handle
- w.C1 = CFrame.new(distance, 0.25 +y, -0.5 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation *-1), math.pi / 2 *-1, 0)
- elseif weldmode == 3 then--barrel pointing upside-right
- local w = Instance.new("Weld")
- w.Part0 = torso
- w.Parent = w.Part0
- w.Part1 = handle
- w.C1 = CFrame.new(distance *-1, 0.25 +y, -0.5 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation), math.pi / 2, 0)
- elseif weldmode == 4 then--barrel pointing upside-left
- local w = Instance.new("Weld")
- w.Part0 = torso
- w.Parent = w.Part0
- w.Part1 = handle
- w.C1 = CFrame.new(distance, 0.25 +y, -0.5 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation), math.pi / 2 *-1, 0)
- end
- end
- --------------------------------------------------------------------------------
- --------------------------------------------------------------------------------
- --------------------------------------------------------------------------------
- --------------------------------------------------------------------------------
- --------------------------------------------------------------------------------
- elseif guntype == 3 then--pistol
- local lleg = model.Parent:FindFirstChild("Left Leg")
- local rleg = model.Parent:FindFirstChild("Right Leg")
- if lleg ~= nil and rleg ~= nil then
- if weldmode == 1 then--pistol on right leg
- local w = Instance.new("Weld")
- w.Part0 = rleg
- w.Parent = w.Part0
- w.Part1 = handle
- w.C1 = CFrame.new(distance *-1, 0 +y, -0.25 +x *-1) * CFrame.fromEulerAnglesXYZ(math.pi / 2, 0, 0)
- elseif weldmode == 2 then--pistol on left leg
- local w = Instance.new("Weld")
- w.Part0 = lleg
- w.Parent = w.Part0
- w.Part1 = handle
- w.C1 = CFrame.new(distance, 0 +y, -0.25 +x *-1) * CFrame.fromEulerAnglesXYZ(math.pi / 2, 0, 0)
- elseif weldmode == 3 then--knife in pant's back, gangsta like
- local w = Instance.new("Weld")
- w.Part0 = torso
- w.Parent = w.Part0
- w.Part1 = handle
- w.C1 = CFrame.new(distance *-1, 0 +y, 0.25 +x) * CFrame.fromEulerAnglesXYZ(math.pi / 2 , math.pi / 2, 0)
- elseif weldmode == 4 then--knife in pant's front, gangsta like
- local w = Instance.new("Weld")
- w.Part0 = torso
- w.Parent = w.Part0
- w.Part1 = handle
- w.C1 = CFrame.new(distance, 0 +y, 0.25 +x) * CFrame.fromEulerAnglesXYZ(math.pi / 2 , math.pi / 2 *-1, 0)
- end
- end
- --------------------------------------------------------------------------------
- --------------------------------------------------------------------------------
- --------------------------------------------------------------------------------
- --------------------------------------------------------------------------------
- --------------------------------------------------------------------------------
- elseif guntype == 4 then--knife
- local lleg = model.Parent:FindFirstChild("Left Leg")
- local rleg = model.Parent:FindFirstChild("Right Leg")
- local torso = model.Parent:FindFirstChild("Torso")
- if lleg ~= nil and rleg ~= nil and torso ~= nil then
- if weldmode == 1 then--pistol on right leg
- local w = Instance.new("Weld")
- w.Part0 = rleg
- w.Parent = w.Part0
- w.Part1 = handle
- w.C1 = CFrame.new(distance *-1, 0.15 +y, -0.25 +x *-1) * CFrame.fromEulerAnglesXYZ(math.pi, 0, 0)
- elseif weldmode == 2 then--pistol on left leg
- local w = Instance.new("Weld")
- w.Part0 = lleg
- w.Parent = w.Part0
- w.Part1 = handle
- w.C1 = CFrame.new(distance, 0.15 +y, -0.25 +x *-1) * CFrame.fromEulerAnglesXYZ(math.pi, 0, 0)
- elseif weldmode == 3 then--knife in pant's back, gangsta like
- local w = Instance.new("Weld")
- w.Part0 = torso
- w.Parent = w.Part0
- w.Part1 = handle
- w.C1 = CFrame.new(distance *-1, 0 +y, 0.25 +x) * CFrame.fromEulerAnglesXYZ(math.pi , math.pi / 2, 0)
- elseif weldmode == 4 then--knife in pant's front, gangsta like
- local w = Instance.new("Weld")
- w.Part0 = torso
- w.Parent = w.Part0
- w.Part1 = handle
- w.C1 = CFrame.new(distance, 0 +y, 0.25 +x) * CFrame.fromEulerAnglesXYZ(math.pi , math.pi / 2 *-1, 0)
- end
- end
- end
- end
- end
- end
- end
- --------------------------------------------------------------------------------
- --------------------------------------------------------------------------------
- --------------------------------------------------------------------------------
- --------------------------------------------------------------------------------
- --------------------------------------------------------------------------------
- if model ~= nil then
- n = 1
- local all = model:GetChildren()
- for i = 1, #all do
- if all[i].className == "Part" then
- all[i].Transparency = 1
- end
- end
- end
- end
- --check
- function off(mouse)
- if model ~= nil then
- n = 1
- local all = model:GetChildren()
- for i = 1, #all do
- if all[i].className == "Part" then
- all[i].Transparency = parts[n]
- local Do = true
- if Do then
- Do = false--dude!
- n = n +1
- end
- end
- end
- end
- end
- --please?
- script.Parent.Equipped:connect(on)
- script.Parent.Unequipped:connect(off)
- end))
- LocalScript36.Name = "Weld2"
- LocalScript36.Parent = LocalScript35
- LocalScript36.Disabled = true
- table.insert(cors,sandbox(LocalScript36,function()
- function Weld(x,y)
- local W = Instance.new("Weld")
- W.Part0 = x
- W.Part1 = y
- local CJ = CFrame.new(x.Position)
- local C0 = x.CFrame:inverse()*CJ
- local C1 = y.CFrame:inverse()*CJ
- W.C0 = C0
- W.C1 = C1
- W.Parent = x
- end
- function Get(A)
- if A.className == "Part" then
- Weld(script.Parent.Handle, A)
- A.Anchored = false
- else
- local C = A:GetChildren()
- for i=1, #C do
- Get(C[i])
- end
- end
- end
- local yes = true
- if yes then
- yes = false
- Get(script.Parent)
- end
- function onDied()
- script.Parent.Parent = nil
- end
- h = script.Parent.Parent:FindFirstChild("Humanoid")
- if h ~= nil then
- h.Died:connect(onDied)
- end
- end))
- Part37.Name = "Handle"
- Part37.Parent = Tool0
- Part37.BrickColor = BrickColor.new("Really black")
- Part37.Reflectance = 1
- Part37.Rotation = Vector3.new(90, 60, -90)
- Part37.CanCollide = false
- Part37.FormFactor = Enum.FormFactor.Custom
- Part37.Size = Vector3.new(0.770000994, 0.930003285, 3.75999236)
- Part37.CFrame = CFrame.new(-10.507762, 1.34270597, -2.33923697, 0, 0.499998987, 0.866025984, 0, 0.866025984, -0.499998987, -1, 0, 0)
- Part37.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- Part37.Position = Vector3.new(-10.507762, 1.34270597, -2.33923697)
- Part37.Orientation = Vector3.new(30, 90, 0)
- Part37.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- Sound38.Name = "Fire"
- Sound38.Parent = Part37
- Sound38.SoundId = "rbxassetid://636316879"
- Sound38.Volume = 1
- Sound39.Name = "Reload"
- Sound39.Parent = Part37
- Sound39.SoundId = "rbxassetid://145081845"
- Sound39.Volume = 1
- SpecialMesh40.Parent = Part37
- SpecialMesh40.MeshId = "http://www.roblox.com/asset/?id=94219391"
- SpecialMesh40.Scale = Vector3.new(0.75, 0.75, 0.75)
- SpecialMesh40.TextureId = "rbxassetid://1153072548"
- SpecialMesh40.MeshType = Enum.MeshType.FileMesh
- SpecialMesh40.Scale = Vector3.new(0.75, 0.75, 0.75)
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = game:GetService("Players").LocalPlayer.Backpack
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement