--gui crap (thanks gui to lua)
local GunUI = Instance.new("ScreenGui")
local Main = Instance.new("Frame")
local Ammo = Instance.new("TextLabel")
local Max = Instance.new("TextLabel")
local a = Instance.new("TextLabel")
local GunName = Instance.new("TextLabel")
GunUI.Name = "GunUI"
GunUI.Parent = owner.PlayerGui
GunUI.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
GunUI.Enabled = false
Main.Name = "Main"
Main.Parent = GunUI
Main.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Main.BorderColor3 = Color3.fromRGB(0, 0, 0)
Main.BorderSizePixel = 0
Main.Position = UDim2.new(1, -171, 1, -183)
Main.Size = UDim2.new(0, 171, 0, 183)
Main.Style = Enum.FrameStyle.DropShadow
Ammo.Name = "Ammo"
Ammo.Parent = Main
Ammo.AnchorPoint = Vector2.new(0.5, 0.5)
Ammo.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Ammo.BackgroundTransparency = 1.000
Ammo.BorderColor3 = Color3.fromRGB(0, 0, 0)
Ammo.BorderSizePixel = 0
Ammo.Position = UDim2.new(0.518295407, 0, 0.460240215, 0)
Ammo.Size = UDim2.new(0, 83, 0, 64)
Ammo.Text = "0"
Ammo.TextColor3 = Color3.fromRGB(255, 255, 255)
Ammo.TextSize = 30.000
Ammo.TextStrokeTransparency = 0.000
Max.Name = "Max"
Max.Parent = Main
Max.AnchorPoint = Vector2.new(0.5, 0.5)
Max.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Max.BackgroundTransparency = 1.000
Max.BorderColor3 = Color3.fromRGB(0, 0, 0)
Max.BorderSizePixel = 0
Max.Position = UDim2.new(0.519750834, 0, 0.822646201, 0)
Max.Size = UDim2.new(0, 83, 0, 64)
Max.Text = "0"
Max.TextColor3 = Color3.fromRGB(255, 255, 255)
Max.TextSize = 30.000
Max.TextStrokeTransparency = 0.000
a.Name = "a"
a.Parent = Main
a.AnchorPoint = Vector2.new(0.5, 0.5)
a.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
a.BackgroundTransparency = 1.000
a.BorderColor3 = Color3.fromRGB(0, 0, 0)
a.BorderSizePixel = 0
a.Position = UDim2.new(0.516668022, 0, 0.631856799, 0)
a.Rotation = 90.000
a.Size = UDim2.new(0, 83, 0, 64)
a.Text = "/"
a.TextColor3 = Color3.fromRGB(255, 255, 255)
a.TextSize = 30.000
a.TextStrokeTransparency = 0.000
GunName.Name = "GunName"
GunName.Parent = Main
GunName.AnchorPoint = Vector2.new(0.5, 0.5)
GunName.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
GunName.BackgroundTransparency = 1.000
GunName.BorderColor3 = Color3.fromRGB(0, 0, 0)
GunName.BorderSizePixel = 0
GunName.Position = UDim2.new(0.518630564, 0, 0.132291496, 0)
GunName.Size = UDim2.new(0, 129, 0, 26)
GunName.Font = Enum.Font.Unknown
GunName.TextColor3 = Color3.fromRGB(255, 255, 255)
GunName.TextSize = 20.000
GunName.TextStrokeTransparency = 0.000
-- end of gui crap
local char = owner.Character
local ls = Instance.new("Weld")
local rs = Instance.new("Weld")
local fire = Instance.new("RemoteEvent")
local lmode = "normal"
local pistol = Instance.new("Tool")
pistol.Name = "Pistol"
pistol.ToolTip = "My trusty sidearm."
local ignore = {char}
local smg = Instance.new("Tool")
smg.Name = "SMG"
smg.ToolTip = "Just shoot until its dead!"
local shotgun = Instance.new("Tool")
shotgun.Name = "Shotgun"
shotgun.ToolTip = "OwO, Choco? You're wrong! Pump shotgun! AAAAGGH"
local shandle = Instance.new("Part")
shandle.Parent = smg
shandle.Size = Vector3.new(0.2,1.8,3.6)
shandle.Name = "Handle"
shandle.Color = Color3.fromRGB(27, 42, 53)
local ghandle = Instance.new("Part")
ghandle.Parent = shotgun
ghandle.Size = Vector3.new(1,1,4)
ghandle.Name = "Handle"
ghandle.Color = Color3.fromRGB(27, 42, 53)
local phandle = Instance.new("Part")
phandle.Size = Vector3.new(0.8,1,1.4)
phandle.Name = "Handle"
phandle.Color = Color3.fromRGB(27, 42, 53)
phandle.Parent = pistol
local mflashTemplate = Instance.new("Part")
mflashTemplate.Size = Vector3.new(0.6,0.84,0.6)
mflashTemplate.Color = Color3.fromRGB(255, 255, 0)
mflashTemplate.Transparency = 0.2
mflashTemplate.CanCollide = false
local mesh = Instance.new("SpecialMesh")
mesh.Parent = mflashTemplate
mesh.Scale = Vector3.new(0.3,0.3,0.3)
mesh.MeshType = Enum.MeshType.FileMesh
mesh.MeshId = "rbxassetid://1323306"
local pmuzzle = Instance.new("Attachment")
pmuzzle.Parent = phandle
pmuzzle.Position = Vector3.new(0,0.3,-0.7)
local smuzzle = Instance.new("Attachment")
smuzzle.Parent = shandle
smuzzle.Position = Vector3.new(0,0.5,-1.55)
local pflash = mflashTemplate:Clone()
pflash.Anchored = true
local sflash = mflashTemplate:Clone()
sflash.Anchored = true
local reload = Instance.new("RemoteEvent")
reload.Name = "Reload"
reload.Parent = char
local pmesh = Instance.new("SpecialMesh")
pmesh.Parent = phandle
pmesh.MeshId = "rbxassetid://4372594"
pmesh.Scale = Vector3.new(0.8,1,1)
local smesh = Instance.new("SpecialMesh")
smesh.Parent = shandle
smesh.MeshId = "rbxassetid://2760846"
smesh.Scale = Vector3.new(-1,1,1)
local gmesh = Instance.new("SpecialMesh")
gmesh.Parent = ghandle
gmesh.MeshId = "rbxassetid://3835506"
gmesh.Scale = Vector3.new(1.8,1.5,1)
local plight = Instance.new("PointLight")
plight.Parent = phandle
plight.Brightness = 5
plight.Range = 16
plight.Enabled = false
plight.Color = Color3.fromRGB(255, 255, 0)
local slight = Instance.new("PointLight")
slight.Parent = smuzzle
slight.Brightness = 5
slight.Range = 16
slight.Enabled = false
slight.Color = Color3.fromRGB(255, 255, 0)
local pfire = Instance.new("Sound")
pfire.Parent = pmuzzle
pfire.SoundId = "rbxassetid://9070225429"
pfire.Volume = 1
local sfire = Instance.new("Sound")
sfire.Parent = smuzzle
sfire.SoundId = "rbxassetid://3746974235"
sfire.Volume = 1
local preload = Instance.new("Sound")
preload.Parent = pmuzzle
preload.SoundId = "rbxassetid://8706061849"
preload.Volume = 1
local sreload = Instance.new("Sound")
sreload.Parent = smuzzle
sreload.SoundId = "rbxassetid://7660903582"
sreload.Volume = 1
local switchlerp = Instance.new("RemoteEvent")
switchlerp.Parent = char
switchlerp.Name = "SwitchLmode"
shotgun.Parent = owner.Backpack
shotgun.Grip = CFrame.new(0,-.1,.6) * CFrame.Angles(0,math.rad(15),0)
smg.Parent = owner.Backpack
smg.Grip = CFrame.new(0,-.1,.6) * CFrame.Angles(0,math.rad(15),0)
pistol.Parent = owner.Backpack
pistol.Grip = CFrame.new(0,-.3,.2) * CFrame.Angles(0,math.rad(15),0)
local l1 = char.Torso["Left Shoulder"]
local r1 = char.Torso["Right Shoulder"]
ls.Enabled = false
ls.Parent = l1.Part0
ls.Part0 = l1.Part0
ls.Part1 = l1.Part1
ls.C0 = l1.C0
ls.C1 = l1.C1
rs.Enabled = false
rs.Parent = r1.Part0
rs.Part0 = r1.Part0
rs.Part1 = r1.Part1
rs.C0 = r1.C0
rs.C1 = r1.C1
fire.Parent = char
fire.Name = "Fire"
switchlerp.OnServerEvent:Connect(function(player)
if lmode == "lerp" then
lmode = "normal"
elseif lmode == "normal" then
lmode = "lerp"
end
end)
local anims = { -- first is left shoulder THEN right shoulder
[1] = {
Frames = {
{CFrame.new(-0.5,0.5,0) * CFrame.Angles(math.rad(40),math.rad(-100),math.rad(-20)),CFrame.new(1,0.5,0) * CFrame.Angles(math.rad(40),math.rad(90),math.rad(10)),.2},
{CFrame.new(-0.5,0.5,0) * CFrame.Angles(0,math.rad(-140),math.rad(-60)),CFrame.new(1,0.5,0) * CFrame.Angles(0,math.rad(120),math.rad(60)),.2},
{CFrame.new(-0.5,0.5,0) * CFrame.Angles(0,math.rad(-140),math.rad(-90)),CFrame.new(.5,.5,0) * CFrame.Angles(0,math.rad(110),math.rad(90)),.2}
}
},
[2] = {
Frames = {
{CFrame.new(-0.5,0.5,0) * CFrame.Angles(0,math.rad(-140),math.rad(-90)),CFrame.new(.5,.5,0) * CFrame.Angles(0,math.rad(110),math.rad(90)),.1},
{CFrame.new(-0.5,0.5,0.3) * CFrame.Angles(0,math.rad(-140),math.rad(-100)),CFrame.new(0.5,0.5,0.3) * CFrame.Angles(0,math.rad(110),math.rad(100)),.05},
{CFrame.new(-0.5,0.5,0) * CFrame.Angles(0,math.rad(-140),math.rad(-90)),CFrame.new(.5,.5,0) * CFrame.Angles(0,math.rad(110),math.rad(90)),.1},
}
},
[3] = {
Frames = {
{CFrame.new(-0.5,0.5,0) * CFrame.Angles(0,math.rad(-140),math.rad(-90)),CFrame.new(.5,.5,0) * CFrame.Angles(0,math.rad(110),math.rad(90)),.3},
{CFrame.new(-1,0.5,0) * CFrame.Angles(0,math.rad(-140),math.rad(-50)),CFrame.new(0.5,0.6,0) * CFrame.Angles(0,math.rad(110),math.rad(100)),.4},
{CFrame.new(-1,0.5,0) * CFrame.Angles(math.rad(10),math.rad(-120),math.rad(5)),CFrame.new(0.5,0.6,0) * CFrame.Angles(0,math.rad(110),math.rad(100)),.6},
{CFrame.new(-1,0.5,0) * CFrame.Angles(0,math.rad(-140),math.rad(-50)),CFrame.new(0.5,0.6,0) * CFrame.Angles(0,math.rad(110),math.rad(100)),.3},
{CFrame.new(-0.5,0.5,0) * CFrame.Angles(0,math.rad(-140),math.rad(-90)),CFrame.new(.5,.5,0) * CFrame.Angles(0,math.rad(110),math.rad(90)),.3},
{CFrame.new(-0.3,0.5,0) * CFrame.Angles(0,math.rad(-140),math.rad(-100)),CFrame.new(.5,.5,0) * CFrame.Angles(0,math.rad(110),math.rad(90)),.2},
{CFrame.new(-0.3,0.5,0.2) * CFrame.Angles(0,math.rad(-150),math.rad(-100)),CFrame.new(0.5,0.5,0.2) * CFrame.Angles(0,math.rad(110),math.rad(90)),.2},
{CFrame.new(-0.5,0.5,0) * CFrame.Angles(0,math.rad(-140),math.rad(-90)),CFrame.new(.5,.5,0) * CFrame.Angles(0,math.rad(110),math.rad(90)),.3},
}
},
[4] = {
Frames = {
{CFrame.new(-1,0.5,0) * CFrame.Angles(math.rad(10),math.rad(-100),math.rad(-20)),CFrame.new(1,0.5,0) * CFrame.Angles(math.rad(40),math.rad(115),math.rad(30)),.2},
{CFrame.new(-1,0.3,-0.3) * CFrame.Angles(math.rad(20),math.rad(-100),math.rad(-50)),CFrame.new(1,0.5,0) * CFrame.Angles(math.rad(50),math.rad(140),math.rad(60)),.2},
{CFrame.new(-0.3,0.5,-1) * CFrame.Angles(0,math.rad(-130),math.rad(-90)),CFrame.new(0.5,0.5,0.3) * CFrame.Angles(0,math.rad(105),math.rad(90)),.2}
}
},
[5] = {
Frames = {
{CFrame.new(-0.3,0.5,-1) * CFrame.Angles(0,math.rad(-130),math.rad(-90)),CFrame.new(0.5,0.5,0.3) * CFrame.Angles(0,math.rad(105),math.rad(90)),.05},
{CFrame.new(-0.3,0.5,-0.7) * CFrame.Angles(0,math.rad(-130),math.rad(-90)),CFrame.new(0.5,0.5,0.5) * CFrame.Angles(0,math.rad(105),math.rad(90)),0.05},
{CFrame.new(-0.3,0.5,-1) * CFrame.Angles(0,math.rad(-130),math.rad(-90)),CFrame.new(0.5,0.5,0.3) * CFrame.Angles(0,math.rad(105),math.rad(90)),.05},
}
},
[6] = {
Frames = {
{CFrame.new(-0.3,0.5,-1) * CFrame.Angles(0,math.rad(-130),math.rad(-90)),CFrame.new(0.5,0.5,0.3) * CFrame.Angles(0,math.rad(105),math.rad(90)),.2},
{CFrame.new(-0.3,0.5,-1) * CFrame.Angles(0,math.rad(-130),math.rad(-50)), CFrame.new(0.5,0.6,0) * CFrame.Angles(math.rad(20),math.rad(105),math.rad(90)),.2},
{CFrame.new(-1,0.5,0) * CFrame.Angles(math.rad(20),math.rad(-130),math.rad(-10)),CFrame.new(0.5,0.6,0) * CFrame.Angles(math.rad(20),math.rad(105),math.rad(90)),1.5},
{CFrame.new(-0.3,0.5,-1) * CFrame.Angles(0,math.rad(-130),math.rad(-50)), CFrame.new(0.5,0.6,0) * CFrame.Angles(math.rad(20),math.rad(105),math.rad(90)),.3},
{CFrame.new(-0.3,0.5,-1) * CFrame.Angles(0,math.rad(-130),math.rad(-90)),CFrame.new(0.5,0.5,0.3) * CFrame.Angles(0,math.rad(105),math.rad(90)),.2},
{CFrame.new(-0.3,0.5,-0.5) * CFrame.Angles(0,math.rad(-130),math.rad(-100)), CFrame.new(0.5,0.5,0.3) * CFrame.Angles(0,math.rad(105),math.rad(90)),.1},
{CFrame.new(-0.3,0.5,-0.3) * CFrame.Angles(0,math.rad(-130),math.rad(-105)), CFrame.new(0.5,0.5,0.2) * CFrame.Angles(0,math.rad(105),math.rad(90)),.3},
{CFrame.new(-0.3,0.5,-1) * CFrame.Angles(0,math.rad(-130),math.rad(-90)),CFrame.new(0.5,0.5,0.3) * CFrame.Angles(0,math.rad(105),math.rad(90)),.2}
}
}
}
local function playID(id)
local anim = anims[id]
for i,v in pairs(anim.Frames) do
if lmode == "lerp" then
spawn(function() -- smooth but the guns are from 2008 for gods sake
for i = 0,1,0.1 do
ls.C0 = ls.C0:Lerp(v[1],i)
rs.C0 = rs.C0:Lerp(v[2],i)
task.wait()
end
end)
elseif lmode == "normal" then
ls.C0 = v[1]
rs.C0 = v[2]
end
task.wait(v[3])
end
end
reload.OnServerEvent:Connect(function(player,gun)
if gun == "Pistol" then
preload:Play()
playID(3)
end
if gun == "SMG" then
sreload:Play()
playID(6)
end
end)
fire.OnServerEvent:Connect(function(player,gun,mhit)
if gun == "Pistol" then
spawn(function()
playID(2)
end)
local pos = mhit.Position
local beam = Instance.new("Part")
beam.Parent = workspace
beam.Anchored = true
beam.CanCollide = false
beam.BrickColor = BrickColor.new("Gold")
beam.Material = Enum.Material.Neon
table.insert(ignore,beam)
local params = RaycastParams.new()
params.FilterDescendantsInstances = ignore
params.FilterType = Enum.RaycastFilterType.Exclude
pfire:Play()
spawn(function()
pflash.CFrame = (pmuzzle.WorldCFrame * CFrame.new(0,0,-.2)) * CFrame.Angles(math.rad(-90),0,0)
pflash.Parent = pmuzzle
plight.Enabled = true
task.wait(.05)
plight.Enabled = false
pflash.Parent = nil
end)
local direction = (pos - pmuzzle.WorldPosition).Unit * 1000
local raycast = workspace:Raycast(pmuzzle.WorldPosition,direction,params)
local intersect = raycast and raycast.Position or smuzzle.WorldPosition + direction
if intersect then
beam.CFrame = CFrame.new(pmuzzle.WorldPosition,intersect) * CFrame.new(0, 0, -(pmuzzle.WorldPosition-intersect).Magnitude / 2)
beam.Size = Vector3.new(.1,.1,(pmuzzle.WorldPosition-intersect).Magnitude)
end
if raycast then
if raycast.Instance then
local v = raycast.Instance
if v.Parent then
if v:FindFirstAncestorOfClass("Model") then
local pchar = v:FindFirstAncestorOfClass("Model")
if pchar:FindFirstChild("Humanoid") then
pchar.Humanoid:TakeDamage(25)
end
end
end
end
end
spawn(function()
for i = 1,10,1 do
beam.Transparency += 0.1
beam.Size -= Vector3.new(.01,.01,0)
task.wait(0.025)
end
beam:Destroy()
end)
end
if gun == "SMG" then
spawn(function()
playID(5)
end)
local pos = mhit.Position
local beam = Instance.new("Part")
beam.Parent = workspace
beam.Anchored = true
beam.CanCollide = false
beam.BrickColor = BrickColor.new("Gold")
beam.Material = Enum.Material.Neon
table.insert(ignore,beam)
local params = RaycastParams.new()
params.FilterDescendantsInstances = ignore
params.FilterType = Enum.RaycastFilterType.Exclude
sfire:Play()
spawn(function()
sflash.CFrame = (smuzzle.WorldCFrame * CFrame.new(0,0,-.2)) * CFrame.Angles(math.rad(-90),0,0)
sflash.Parent = smuzzle
slight.Enabled = true
task.wait(.05)
slight.Enabled = false
sflash.Parent = nil
end)
local direction = (pos - smuzzle.WorldPosition).Unit * 1000
local raycast = workspace:Raycast(smuzzle.WorldPosition,direction,params)
local intersect = raycast and raycast.Position or smuzzle.WorldPosition + direction
if intersect then
beam.CFrame = CFrame.new(smuzzle.WorldPosition,intersect) * CFrame.new(0, 0, -(smuzzle.WorldPosition-intersect).Magnitude / 2)
beam.Size = Vector3.new(.1,.1,(smuzzle.WorldPosition-intersect).Magnitude)
end
if raycast then
if raycast.Instance then
local v = raycast.Instance
if v.Parent then
if v:FindFirstAncestorOfClass("Model") then
local pchar = v:FindFirstAncestorOfClass("Model")
if pchar:FindFirstChild("Humanoid") then
pchar.Humanoid:TakeDamage(15)
end
end
end
end
end
spawn(function()
for i = 1,10,1 do
beam.Transparency += 0.1
beam.Size -= Vector3.new(.01,.01,0)
task.wait(0.025)
end
beam:Destroy()
end)
end
end)
pistol.Equipped:Connect(function()
l1.Enabled = false
r1.Enabled = false
ls.Enabled = true
rs.Enabled = true
playID(1)
end)
pistol.Unequipped:Connect(function()
ls.Enabled = false
rs.Enabled = false
l1.Enabled = true
r1.Enabled = true
end)
smg.Equipped:Connect(function()
l1.Enabled = false
r1.Enabled = false
ls.Enabled = true
rs.Enabled = true
playID(4)
end)
smg.Unequipped:Connect(function()
ls.Enabled = false
rs.Enabled = false
l1.Enabled = true
r1.Enabled = true
end)
NLS([==[
local char = owner.Character
local mouse = owner:GetMouse()
local smg = char:FindFirstChild("SMG") or owner.Backpack:FindFirstChild("SMG")
local pistol = char:FindFirstChild("Pistol") or owner.Backpack:FindFirstChild("Pistol")
local pistolDB = false
local pistolReloading = false
local smgDB = false
local smgReloading = false
local firingPistol = false
local run = game:GetService("RunService")
local firingSMG = false
local gui = owner.PlayerGui.GunUI
local pammo = 12
local uis = game:GetService("UserInputService")
local pmags = 99
local smags = 99
local sammo = 35
function updgui()
if pistol.Parent == char then
gui.Main.GunName.Text = pistol.Name
gui.Main.Ammo.Text = tostring(pammo)
gui.Main.Max.Text = tostring(pmags)
elseif smg.Parent == char then
gui.Main.GunName.Text = smg.Name
gui.Main.Ammo.Text = tostring(sammo)
gui.Main.Max.Text = tostring(smags)
end
end
pistol.Equipped:Connect(function()
gui.Enabled = true
updgui()
end)
pistol.Unequipped:Connect(function()
gui.Enabled = false
firingPistol = false
end)
smg.Equipped:Connect(function()
gui.Enabled = true
updgui()
end)
smg.Unequipped:Connect(function()
gui.Enabled = false
firingSMG = false
end)
pistol.Activated:Connect(function()
firingPistol = true
end)
pistol.Deactivated:Connect(function()
firingPistol = false
end)
smg.Activated:Connect(function()
firingSMG = true
end)
smg.Deactivated:Connect(function()
firingSMG = false
end)
uis.InputBegan:Connect(function(input,busy)
if not busy then
if input.KeyCode == Enum.KeyCode.R then
if pistol.Parent == char and not pistolReloading then
pistolDB = true
pistolReloading = true
pmags = pmags - 1
char.Reload:FireServer(pistol.Name)
task.wait(2.8)
pammo = 12
updgui()
pistolReloading = false
pistolDB = false
end
if smg.Parent == char and not smgReloading then
smgDB = true
smgReloading = true
smags = smags - 1
char.Reload:FireServer(smg.Name)
task.wait(2.6)
sammo = 35
updgui()
smgReloading = false
smgDB = false
end
end
if input.KeyCode == Enum.KeyCode.L then
char.SwitchLmode:FireServer()
end
end
end)
run.RenderStepped:Connect(function()
if firingPistol then
if not pistolDB and pammo > 0 then
pistolDB = true
char.Fire:FireServer("Pistol",mouse.Hit)
spawn(function()
task.wait(.2)
pammo = pammo - 1
updgui()
end)
task.wait(.5)
pistolDB = false
end
end
if firingSMG then
if not smgDB and sammo > 0 then
smgDB = true
char.Fire:FireServer("SMG",mouse.Hit)
sammo = sammo - 1
updgui()
task.wait(.1)
smgDB = false
end
end
end)
]==])