Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tool=Instance.new("HopperBin", game.Players.LocalPlayer.Backpack)
- tool.Name="Knife"
- wait()
- script.Parent=tool
- --Murderer knife action script, original code from The Mad Murderer, by loleris.
- wait()
- local camera = game.Workspace.CurrentCamera
- local player = game.Players.LocalPlayer
- local character = player.Character
- local humanoid = character.Humanoid
- local head = character.Head
- local torso = character.Torso
- local pl_mouse = player:GetMouse()
- local rs = game:GetService("RunService")
- local stab_damage = 110
- local walkspeeds = {16, 19}
- Settings = {
- Equip_time = 0.4,
- Idle_speed = 5,
- Attack_speed = 0.65,
- }
- local assetlink = "http://www.roblox.com/asset/?id="
- local hit_sounds = {"153647516", "153647519", "153647522", "153647526"}
- local death_sounds = {"146594640", "146594648", "146457047"}
- function Clean(obj)
- spawn(function()
- wait(6)
- obj:remove()
- end)
- end
- function HIT_HANDLE(hit, dmg, pos)
- if hit == nil then return end
- local h = hit.Parent:findFirstChild("Humanoid")
- if h == nil then
- h = hit.Parent.Parent:findFirstChild("Humanoid")
- end
- if h == nil then return end
- if h.Health <= 0 then return end
- local head = h.Parent:findFirstChild("Head")
- if head == nil then return end
- local sound_part = Instance.new("Part")
- sound_part.formFactor = "Custom"
- sound_part.Size = Vector3.new(0.2, 0.2, 0.2)
- sound_part.Transparency = 1
- sound_part.CanCollide = false
- sound_part.Anchored = true
- sound_part.CFrame = head.CFrame
- Clean(sound_part)
- sound_part.Parent = Workspace
- local s_hit = Instance.new("Sound")
- s_hit.Volume = 1
- s_hit.SoundId = assetlink .. hit_sounds[math.random(1, #hit_sounds)]
- s_hit.Parent = sound_part
- local s_die = Instance.new("Sound")
- s_die.Volume = 1
- s_die.SoundId = assetlink .. death_sounds[math.random(1, #death_sounds)]
- s_die.Parent = sound_part
- s_hit:play()
- local c_tag = Instance.new("ObjectValue")
- c_tag.Name = "creator"
- c_tag.Value = player
- c_tag.Parent = h
- h.Health=0
- s_die:play()
- end
- function GENERATE_IGNORELIST()
- local result = {character, camera}
- local plr = game.Players:GetPlayers()
- for i = 1, #plr do
- if plr[i] ~= player then
- local char = plr[i].Character
- if char ~= nil then
- local ch = char:GetChildren()
- for i = 1, #ch do
- if ch[i]:IsA("Hat") or ch[i]:IsA("Tool") then
- result[#result + 1] = ch[i]
- end
- end
- end
- end
- end
- return result
- end
- function RayCast(pos1, pos2, dist, ign)
- local ray = Ray.new(
- pos1,
- (pos2 - pos1).unit * math.abs(dist)
- )
- local hit, hpos = Workspace:FindPartOnRayWithIgnoreList(ray, ign, false)
- return hit, hpos
- end
- local larm = character:findFirstChild("Left Arm")
- local rarm = character:findFirstChild("Right Arm")
- function Slash(del)
- coroutine.resume(coroutine.create(function()
- local hits = {}
- local start = tick()
- local actv = true
- local function ishitted(obj)
- for i = 1, #hits do
- if obj:IsDescendantOf(hits[i]) then
- return true
- end
- end
- return false
- end
- local function hitp(hit)
- if ishitted(hit) then return end
- local h = hit.Parent:findFirstChild("Humanoid")
- if h == nil then
- h = hit.Parent.Parent:findFirstChild("Humanoid")
- end
- if h == nil then return end
- hits[#hits + 1] = h.Parent
- HIT_HANDLE(hit, stab_damage)
- end
- local con = {
- larm.Touched:connect(hitp),
- rarm.Touched:connect(hitp),
- }
- while tick() - start <= Settings.Attack_speed do wait() end
- actv = false
- con[1]:disconnect()
- con[2]:disconnect()
- end))
- end
- local dg_sounds = {
- equip = {
- "153647514"
- },
- hit = {
- "153647516",
- "153647519",
- "153647522",
- "153647526"
- },
- swing = {
- "153647529",
- "153647534",
- "153647539",
- "153647540"
- }
- }
- local dg_soundobj = {}
- for k, v in pairs(dg_sounds) do
- dg_soundobj[k] = {}
- for i = 1, #v do
- local ns = Instance.new("Sound")
- ns.SoundId = assetlink .. v[i]
- ns.Volume = 1
- dg_soundobj[k][#dg_soundobj[k] + 1] = ns
- end
- end
- function LoadSounds()
- for __, v in pairs(dg_soundobj) do
- for i = 1, #v do
- v[i].Parent = head
- end
- end
- end
- function RemoveSounds()
- for __, v in pairs(dg_soundobj) do
- for i = 1, #v do
- v[i].Parent = nil
- end
- end
- end
- function PlaySound(nm, dl)
- if dl == nil then
- dg_soundobj[nm][math.random(1, #dg_soundobj[nm])]:play()
- else
- coroutine.resume(coroutine.create(function()
- wait(dl)
- dg_soundobj[nm][math.random(1, #dg_soundobj[nm])]:play()
- end))
- end
- end
- _G.MurderKnife_AnimType = "Default"
- _G.MurderKnife_AnimState = 0
- function Animate(tp, st)
- _G.MurderKnife_AnimType = tp
- _G.MurderKnife_AnimState = st
- end
- tool.Selected:connect(function(mouse) --Default, Idle1, Idle2, Attack1, Attack2
- humanoid.WalkSpeed = walkspeeds[2]
- mouse.Icon = assetlink .. "54019936"
- Animate("Equip", 0)
- LoadSounds()
- PlaySound("equip", 0.1)
- local anim_equip = 1
- local last_action = tick()
- local idle_rand = math.random(4, 7)
- local idle_perform = 0
- local idle_type = 1
- local attack_perform = 0
- local attack_type = 1
- local running = true
- local last_c = tick()
- local click_start = tick()
- mouse.Button1Down:connect(function()
- if not running or anim_equip > 0 then return end
- if tick() - attack_perform <= Settings.Attack_speed then return end
- attack_perform = tick()
- last_action = tick()
- attack_type = math.random(1, 3)
- idle_perform = 0
- PlaySound("swing", 0.15)
- Slash(0.17)
- end)
- local conn = rs.RenderStepped:connect(function()
- if not running then return end
- local delta = tick() - last_c
- last_c = tick()
- if anim_equip > 0 then
- anim_equip = math.max(0, anim_equip - (delta / Settings.Equip_time))
- Animate("Equip", 1 - anim_equip)
- elseif tick() - attack_perform <= Settings.Attack_speed then
- Animate("Attack" .. attack_type, (tick() - attack_perform) / Settings.Attack_speed)
- idle_perform = 0
- elseif tick() - idle_perform <= Settings.Idle_speed then
- Animate("Idle" .. idle_type, (tick() - idle_perform) / Settings.Idle_speed)
- else
- Animate("Default", 0)
- end
- if tick() - last_action >= idle_rand then
- idle_rand = math.random(12, 20)
- last_action = tick()
- idle_perform = tick()
- idle_type = math.random(1, 2)
- end
- end)
- tool.Deselected:connect(function() running = false conn:disconnect() end)
- end)
- tool.Deselected:connect(function()
- RemoveSounds()
- humanoid.WalkSpeed = walkspeeds[1]
- end)
- --Murderer knife animation module, original code from The Mad Murderer, by loleris.
- local mouse = pl_mouse
- local conn_type = "Snap"
- local anim_head = false
- weapon_properties = {
- mesh_id = "http://www.roblox.com/asset/?id=121944778",
- texture_id = "http://www.roblox.com/asset/?id=121944805",
- scale = Vector3.new(0.6, 0.6, 0.6),
- transparency = 0,
- reflectance = 0,
- brick_color = BrickColor.new("Really black"),
- }
- --How did I make all of this? Magic. Didn't even need an animation editor :)
- Animations = {
- Default = {
- {{}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.873, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)}
- },
- Equip = {
- {{}, 0, CFrame.new(0, 0, 0) * CFrame.Angles(-1.571, 0, 0), CFrame.new(0, 0, 0) * CFrame.Angles(-1.571, 0, 0), CFrame.new(0, -1.3, -0.5) * CFrame.Angles(-2.618, 0, 0)},
- {{0.8, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.524, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(0, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
- {{0.2, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.873, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
- },
- Idle1 = {
- {{}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.873, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
- {{0.3, 2}, 0, CFrame.new(0.8, -0.301, 0.2) * CFrame.Angles(-0.35, 0, 0.872), CFrame.new(-0.201, 0, 0) * CFrame.Angles(0.523, 1.221, -0.699), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 1.221, 0)},
- {{0.55, 2}, 0, CFrame.new(0.2, -0.5, 0.2) * CFrame.Angles(-0.14, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(0, 1.221, -0.175), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.746, 1.221, 0.174)},
- {{0.15, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.873, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
- },
- Idle2 = {
- {{}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.873, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
- {{0.3, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.524, 0, 0.872), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, -0.175, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0.523, 0)},
- {{0.3, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(0.349, 0, 0.523), CFrame.new(-0.201, 0, 0) * CFrame.Angles(0.174, 0.698, -0.524), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, -1.222, 0)},
- {{0.2, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(0.61, 0, 0.349), CFrame.new(-0.201, 0, 0) * CFrame.Angles(0.139, 0.663, -0.489), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, -1.222, 0)},
- {{0.2, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.873, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)}
- },
- Attack1 = {
- {{}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.873, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
- {{0.25, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-1.048, 0, 0.349), CFrame.new(-0.201, 0, 0) * CFrame.Angles(0.872, 0.349, 0.087), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
- {{0.15, 2}, 0, CFrame.new(0.4, -0.101, 0.1) * CFrame.Angles(-1.571, 0, -0.35), CFrame.new(-0.301, -0.301, 0.1) * CFrame.Angles(-1.048, -0.175, -0.524), CFrame.new(0, -1.201, -0.801) * CFrame.Angles(-2.095, 0, 0)},
- {{0.6, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.873, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)}
- },
- Attack2 = {
- {{}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.873, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
- {{0.25, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.699, 0, 0.872), CFrame.new(-0.401, 0.3, 0.1) * CFrame.Angles(1.919, 2.443, -1.222), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
- {{0.15, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-1.048, 0, -0.524), CFrame.new(-0.5, -0.201, -0.101) * CFrame.Angles(0.523, 1.396, -0.873), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
- {{0.6, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.873, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)}
- },
- Attack3 = {
- {{}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.873, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)},
- {{0.25, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-1.397, 0, 0.174), CFrame.new(-0.401, -0.201, 0) * CFrame.Angles(1.396, 0.698, -1.571), CFrame.new(0, -1.3, -0.401) * CFrame.Angles(-2.444, 0, 0)},
- {{0.15, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-1.397, 0, 0.174), CFrame.new(-0.401, 0.1, 0) * CFrame.Angles(0.349, 2.094, -0.524), CFrame.new(0, -1.3, 0.1) * CFrame.Angles(-3.84, 0, 0)},
- {{0.6, 2}, 0, CFrame.new(0.4, -0.201, 0.2) * CFrame.Angles(-0.873, 0, 0.698), CFrame.new(-0.201, 0, 0) * CFrame.Angles(-0.175, 0.349, -0.262), CFrame.new(0, -0.95, -0.801) * CFrame.Angles(-1.571, 0, 0)} --Psst. Create a dummy, try setting position and angles of limbs and the weapon, save CFrame data to code. Easy? Yes. When making a single knife tool, it was all you needed.
- }
- }
- function CFrameTrans(GetCFrame1, GetCFrame2, GetNumber)
- local Diff2 = GetCFrame2.p - GetCFrame1.p
- GetCFrame1_s = GetCFrame1 - GetCFrame1.p
- GetCFrame2 = GetCFrame2 - GetCFrame2.p
- local Diff = GetCFrame1_s:inverse() * GetCFrame2
- local x1, y1, z1 = Diff:toEulerAnglesXYZ()
- return (GetCFrame1 + (Diff2 * GetNumber)) * CFrame.Angles(x1 * GetNumber, y1 * GetNumber, z1 * GetNumber)
- end
- function TransEff(x, type)
- if type == 1 then
- return x
- elseif type == 2 then
- return x*x*(3 - 2*x)
- elseif type == 3 then
- return math.sin(math.rad(x * 90))
- elseif type == 4 then
- return 1 - math.sin(math.rad((1 - x) * 90))
- end
- end
- function num_trans(n1, n2, x)
- return n1 + ((n2 - n1) * x)
- end
- function PlayAnimation(anim_name, tm) --return {left, right, wep, trans}
- tm = math.min(1, math.max(0, tm))
- local animd = Animations[anim_name]
- if #animd == 1 then
- return {animd[1][3], animd[1][4], animd[1][5], animd[1][2]}
- else
- local trans_from = 1
- local trans_to = 1
- local tm_left = tm
- for i = 2, #animd do
- tm_left = tm_left - animd[i][1][1]
- if tm_left <= 0 then
- trans_from = i - 1
- trans_to = i
- break
- end
- end
- local trans_amm = TransEff((animd[trans_to][1][1] + tm_left) / animd[trans_to][1][1], animd[trans_to][1][2])
- return {
- CFrameTrans(animd[trans_from][3], animd[trans_to][3], trans_amm),
- CFrameTrans(animd[trans_from][4], animd[trans_to][4], trans_amm),
- CFrameTrans(animd[trans_from][5], animd[trans_to][5], trans_amm),
- num_trans(animd[trans_from][2], animd[trans_to][2], trans_amm)
- }
- end
- end
- rot_amplitude_head = 20
- rot_amplitude_chest = 15
- anim_p = {
- cam_offset = CFrame.new(0.2, -0.37, 0.91) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)),
- aim_amp = 0.5,
- aim_max_change = 4,
- aim_retract = 15,
- aim_max_deg = 20,
- }
- local weapon_model = Instance.new("Part")
- weapon_model.CanCollide = false
- weapon_model.Name = "WeaponObject"
- weapon_model.formFactor = "Custom"
- weapon_model.Size = Vector3.new(0.2, 0.2, 0.2)
- weapon_model.TopSurface = 0
- weapon_model.BottomSurface = 0
- weapon_model.BrickColor = weapon_properties.brick_color
- weapon_model.Transparency = weapon_properties.transparency
- weapon_model.Reflectance = weapon_properties.reflectance
- local mesh = Instance.new("SpecialMesh", weapon_model)
- mesh.Scale = weapon_properties.scale
- mesh.MeshId = weapon_properties.mesh_id
- mesh.TextureId = weapon_properties.texture_id
- torso = character.Torso
- head = character.Head
- motors = {torso:findFirstChild("Left Shoulder"), torso:findFirstChild("Right Shoulder"), torso:findFirstChild("Neck")}
- welds = {nil, nil, nil}
- weapon_parts = {weapon_model:clone(), weapon_model:clone()}
- weapon_model = nil
- function EndAnimation()
- if motors[1] then
- motors[1].Part1 = character:findFirstChild("Left Arm")
- end
- if motors[2] then
- motors[2].Part1 = character:findFirstChild("Right Arm")
- end
- if motors[3] then
- motors[3].Part1 = character:findFirstChild("Head")
- end
- if welds[1] then
- welds[1]:remove()
- welds[1] = nil
- end
- if welds[2] then
- welds[2]:remove()
- welds[2] = nil
- end
- if welds[3] then
- welds[3]:remove()
- welds[3] = nil
- end
- weapon_parts[1].Parent = nil
- if weapon_model then
- weapon_model.Parent = nil
- end
- coroutine.resume(coroutine.create(function()
- local swm = weapon_model
- wait()
- swm.Parent = nil
- wait(0.1)
- swm.Parent = nil
- wait(0.5)
- swm.Parent = nil
- end))
- end
- local anim_model = Instance.new("Model")
- anim_model.Name = "WeaponAnimation"
- weapon_model = anim_model
- local cam_larm = Instance.new("Part")
- cam_larm.Parent = anim_model
- cam_larm.BrickColor = BrickColor.new("Really black")
- cam_larm.formFactor = "Custom"
- cam_larm.Size = Vector3.new(0.2, 0.2, 0.2)
- cam_larm.TopSurface = 0
- cam_larm.BottomSurface = 0
- cam_larm.Transparency = 0.4
- cam_larm.CanCollide = false
- local hmesh = Instance.new("BlockMesh", cam_larm)
- hmesh.Scale = Vector3.new(5, 10, 5)
- local cam_rarm = cam_larm:clone()
- cam_rarm.Parent = anim_model
- function StartAnimation()
- local check = {torso:findFirstChild("LeftWeld"), torso:findFirstChild("RightWeld"), torso:findFirstChild("HeadWeld")}
- if check[1] then check[1]:remove() end
- if check[2] then check[2]:remove() end
- if check[3] then check[3]:remove() end
- local check2 = {character:findFirstChild("WeaponObject"), camera:findFirstChild("WeaponAnimation")}
- if check2[1] then check2[1].Parent = nil end
- if check2[2] then check2[2].Parent = nil end
- if motors[1] then
- motors[1].Part1 = nil
- end
- if motors[2] then
- motors[2].Part1 = nil
- end
- if motors[3] then
- motors[3].Part1 = nil
- end
- welds = {Instance.new(conn_type), Instance.new(conn_type), Instance.new(conn_type)}
- welds[1].Part0 = torso
- welds[2].Part0 = torso
- welds[3].Part0 = torso
- welds[1].Part1 = character:findFirstChild("Left Arm")
- welds[2].Part1 = character:findFirstChild("Right Arm")
- welds[3].Part1 = character:findFirstChild("Head")
- welds[1].Name = "LeftWeld"
- welds[2].Name = "RightWeld"
- welds[2].Name = "HeadWeld"
- welds[1].C0 = CFrame.new(-1.5, 0, 0)
- welds[2].C0 = CFrame.new(1.5, 0, 0)
- welds[3].C0 = CFrame.new(0, 1.5, 0)
- welds[1].Parent = torso
- welds[2].Parent = torso
- welds[3].Parent = torso
- weapon_parts[1].Parent = character
- local wep_weld = Instance.new(conn_type)
- wep_weld.Part0 = character:findFirstChild("Right Arm")
- wep_weld.Part1 = weapon_parts[1]
- wep_weld.C0 = CFrame.new()
- wep_weld.Parent = weapon_parts[1]
- local weld1 = welds[1]
- local weld2 = welds[2]
- local weld3 = welds[3]
- local cam_welds = {Instance.new(conn_type), Instance.new(conn_type), Instance.new(conn_type)}
- cam_welds[1].Part0 = torso
- cam_welds[1].Part1 = cam_larm
- cam_welds[1].Parent = cam_larm
- cam_welds[2].Part0 = torso
- cam_welds[2].Part1 = cam_rarm
- cam_welds[2].Parent = cam_rarm
- cam_welds[3].Part0 = cam_rarm
- cam_welds[3].Part1 = weapon_parts[2]
- cam_welds[3].Parent = weapon_parts[2]
- weapon_parts[2].Parent = anim_model
- local move_anim_speed = 3
- local last_p = Vector3.new()
- local move_amm = 0
- coroutine.resume(coroutine.create(function()
- while weld1.Parent ~= nil do
- local delta = wait(1/25)
- local cur_p = torso.Position
- if (cur_p - last_p).magnitude >= 0.1 then
- move_amm = math.min(1, move_amm + delta * move_anim_speed)
- else
- move_amm = math.max(0, move_amm - delta * move_anim_speed)
- end
- last_p = cur_p
- end
- end))
- local r_serv = game:GetService("RunService")
- --EASTER EGG
- function easein(x)
- return math.sin(math.rad(x * 90))
- end
- local a_horse = (character:findFirstChild("HorseHead") ~= nil)
- local horse_displace = {0, 0}
- local horse_cf = CFrame.Angles(0.0001, 0.0001, 0)
- if a_horse then
- coroutine.resume(coroutine.create(function()
- while weld1.Parent ~= nil do
- local rndwait = (math.random(100, 1000) / 1000) * 4
- wait(rndwait)
- local oldd = {horse_displace[1], horse_displace[2]}
- local disp2 = {math.random(-60, 60), math.random(0, 25)}
- local ld = 0
- while ld ~= 1 do
- local st = tick()
- r_serv.RenderStepped:wait()
- ld = math.min(1, ld + ((tick() - st) * 4))
- local eff = easein(ld)
- local x = oldd[1] - ((oldd[1] - disp2[1]) * eff)
- local y = oldd[2] - ((oldd[2] - disp2[2]) * eff)
- horse_displace = {x, y}
- horse_cf = CFrame.Angles(math.rad(y), math.rad(x) , 0)
- end
- end
- end))
- end
- --EASTER EGG
- local last_va = 0
- local last_va2 = 0
- local view_velocity = {0, 0}
- coroutine.resume(coroutine.create(function()
- local last_time = tick()
- while weld1.Parent ~= nil do
- r_serv.RenderStepped:wait() ------------------------------------------------
- local delta = tick() - last_time
- last_time = tick()
- local breathe_amp = 2
- local breathe_freq = 0.8
- local breathe = math.sin(math.rad(tick() * 90 * breathe_freq)) * breathe_amp
- local shake_freq = 5
- local shake_amp = {0.05, 0.05}
- local arm_shake = CFrame.new(
- math.sin(math.rad(tick() * 90 * shake_freq)) * move_amm * shake_amp[1],
- 0,
- math.abs(math.sin(math.rad(tick() * 90 * shake_freq)) * move_amm * shake_amp[2]))
- --ANIMATION LOOP
- local p_distance = (head.Position - mouse.Hit.p).magnitude
- if p_distance == 0 then p_distance = 0.0001 end
- local p_height = mouse.Hit.p.y - head.Position.y
- local view_angle
- if p_height ~= 0 then
- view_angle = math.deg(math.asin(math.abs(p_height) / p_distance)) * (math.abs(p_height) / p_height)
- else
- view_angle = 0
- end
- local cam_cf = camera.CoordinateFrame
- local looking_at = cam_cf * CFrame.new(0, 0, -100)
- local view_angle2 = math.deg(math.atan2(cam_cf.p.x - looking_at.p.x, cam_cf.p.z - looking_at.p.z)) + 180
- local v_delta1, v_delta2
- local dir1 = 0
- local dir2 = 0
- v_delta1 = math.abs(view_angle - last_va)
- if v_delta1 ~= 0 then
- dir1 = (view_angle - last_va) / v_delta1
- end
- local va_check = {math.abs(view_angle2 - last_va2), 360 - math.abs(view_angle2 - last_va2)}
- if view_angle2 == last_va2 then
- dir2 = 0
- v_delta2 = 0
- elseif va_check[1] < va_check[2] then
- v_delta2 = va_check[1]
- dir2 = (view_angle2 - last_va2) / va_check[1]
- else
- v_delta2 = va_check[2]
- if last_va2 > view_angle2 then
- dir2 = 1
- else
- dir2 = -1
- end
- end
- last_va = view_angle
- last_va2 = view_angle2
- view_velocity[1] = view_velocity[1] / (1 + (delta * anim_p.aim_retract))
- view_velocity[2] = view_velocity[2] / (1 + (delta * anim_p.aim_retract))
- local calc1 = v_delta1 * dir1 * anim_p.aim_amp
- if calc1 ~= 0 then
- view_velocity[1] = view_velocity[1] + (math.min(anim_p.aim_max_change, math.abs(calc1)) * (calc1 / math.abs(calc1)))
- end
- local calc2 = v_delta2 * dir2 * anim_p.aim_amp
- if calc2 ~= 0 then
- view_velocity[2] = view_velocity[2] + (math.min(anim_p.aim_max_change, math.abs(calc2)) * (calc2 / math.abs(calc2)))
- end
- if view_velocity[1] ~= 0 then
- view_velocity[1] = math.min(anim_p.aim_max_deg, math.abs(view_velocity[1])) * (math.abs(view_velocity[1]) / view_velocity[1])
- end
- if view_velocity[2] ~= 0 then
- view_velocity[2] = math.min(anim_p.aim_max_deg, math.abs(view_velocity[2])) * (math.abs(view_velocity[2]) / view_velocity[2])
- end
- local anmtp = _G.MurderKnife_AnimType
- local anmst = _G.MurderKnife_AnimState
- if anmst == nil then
- anmst = 0
- end
- if anmtp ~= nil then
- if Animations[anmtp] == nil then
- anmtp = "Default"
- end
- else
- anmtp = "Default"
- end
- local curr_anim = PlayAnimation(anmtp, anmst) --left, right, weapon, wep trans
- --curr_anim = {Animations.Default[1][3], Animations.Default[1][4], Animations.Default[1][5], 0}
- local chestCF = CFrame.new(0, 0.5, 0) * CFrame.Angles(math.rad(math.max(-rot_amplitude_chest, math.min(rot_amplitude_chest, view_angle)) + 90 + breathe), 0, 0)
- weld1.C1 = (chestCF * curr_anim[1] * CFrame.new(0, -0.5, 0)):inverse()
- weld2.C1 = (chestCF * curr_anim[2] * CFrame.new(0, -0.5, 0)):inverse()
- wep_weld.C1 = (curr_anim[3]):inverse()
- weapon_parts[1].Transparency = curr_anim[4]
- if anim_head then
- weld3.C1 = (CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(math.max(-rot_amplitude_head, math.min(rot_amplitude_head, view_angle))), 0, 0) * horse_cf):inverse()
- else
- weld3.C1 = (CFrame.new(0, 0, 0)):inverse()
- end
- if (head.Position - camera.CoordinateFrame.p).magnitude < 3 then
- if anim_model.Parent == nil then
- anim_model.Parent = camera
- end
- cam_welds[1].Parent = cam_larm
- cam_welds[2].Parent = cam_rarm
- cam_welds[3].Parent = weapon_parts[2]
- local cam_cf = camera.CoordinateFrame * CFrame.Angles(math.rad(90 + (breathe / 2) - view_velocity[1]), 0, math.rad(view_velocity[2])) * arm_shake * anim_p.cam_offset
- cam_welds[1].C1 = (torso.CFrame:inverse() * cam_cf * CFrame.new(-1.5, 0, 0) * curr_anim[1] * CFrame.new(0, -0.5, 0)):inverse()
- cam_welds[2].C1 = (torso.CFrame:inverse() * cam_cf * CFrame.new(1.5, 0, 0) * curr_anim[2] * CFrame.new(0, -0.5, 0)):inverse()
- cam_welds[3].C1 = (curr_anim[3]):inverse()
- weapon_parts[2].Transparency = curr_anim[4]
- else
- if anim_model.Parent ~= nil then
- anim_model.Parent = nil
- end
- end
- --ANIMATION LOOP
- end
- end))
- end
- local last_st = 0
- local eq = false
- tool.Selected:connect(function(mouse)
- if eq then return end
- eq = true
- wait()
- StartAnimation()
- end)
- tool.Deselected:connect(function()
- eq = false
- EndAnimation()
- end)
- --[[
- Smith and Wesson M&P 45, chambered in .45 ACP ammunition.
- The standard magazine holds 10 rounds, although magazines that could hold 14 rounds were also made but looked incredibly stupid.
- Credit to litozinnamon for the crosshairs and bullethole decals. I used them without permission. Not like I asked him, anyhow.
- ]]
- plr=game:service'Players'.LocalPlayer
- ch,char=plr.Character,plr.Character
- hum=ch.Humanoid
- tor,torso,rootpart,rj=ch.Torso,ch.Torso,ch.HumanoidRootPart,ch.HumanoidRootPart.RootJoint
- m,mouse=plr:GetMouse(),plr:GetMouse()
- cfn,ang,mr,int=CFrame.new,CFrame.Angles,math.rad,Instance.new
- bc=BrickColor.new
- head=ch.Head
- cam=workspace.CurrentCamera
- rj.C0=cfn()
- rj.C1=cfn()
- sheathed=false
- jammed=false
- local minimumsize = Vector3.new(0.7,0.7,0.7) --Minimumsize for a part to get divided,higher numbers = less detailed and bigger/less bricks
- local surface_between_splitted_parts = 'SmoothNoOutlines' --the surface between splitted parts
- --local fragmented = workspace:FindFirstChild("Fragmented")
- local fragmentable = workspace --all fragmentable objects should be stored in here
- local list = {}
- local brickcount = 0
- --local m = Instance.new("Hint",workspace)
- local storage = {}
- local fillup = 1000 --it constantly generates new parts until it reaches this number(hacky way to prevent lagspikes if there is a large explosion),change it to 0 if you don´t want it to generate (useless) parts.
- local maximumstorage = 2000 --it will recycle parts if the number of parts in the storage doesnt exceed this number
- local storage_position = Vector3.new(0,0,5000) --place them somewhere off the map
- local stored_partsize = Vector3.new(1,1,1) --make them small
- local parts_created_per_frame = 5 --number of parts being created per frame to fill up the storage
- function fragmentate(cframe,size,color,explosion_position,explosion_blastradius,backsurface,bottomsurface,frontsurface,leftsurface,rightsurface,topsurface,transparency,reflectance)
- local xi = size.X >= minimumsize.X*(1+explosion_blastradius/16) and 2 or 1 --to reduce the lagg in large explosions we increase minimumsize based on the explosionradius...
- local yi = size.Y >= minimumsize.Y*(1+explosion_blastradius/16) and 2 or 1
- local zi = size.Z >= minimumsize.Z*(1+explosion_blastradius/16) and 2 or 1
- if xi == 1 and yi == 1 and zi == 1 or (cframe.p-explosion_position).magnitude > size.magnitude/2 + explosion_blastradius then --don´t fragmentate parts, that are too small to fragmentate or too far away from the explosion
- if xi == 1 and yi == 1 and zi == 1 then return end --optional
- if #storage > 0 then
- local p = storage[1]
- p.BrickColor = color
- p.Size = size
- p.BackSurface = backsurface
- p.BottomSurface = bottomsurface
- p.FrontSurface = frontsurface
- p.LeftSurface = leftsurface
- p.RightSurface = rightsurface
- p.TopSurface = topsurface
- p.Transparency = transparency
- p.CFrame = cframe
- p.Reflectance = reflectance
- table.remove(storage,1)
- else
- local p = Instance.new("Part",fragmentable)
- p.BrickColor = color
- p.FormFactor = "Custom"
- p.Size = size
- p.BackSurface = backsurface
- p.BottomSurface = bottomsurface
- p.FrontSurface = frontsurface
- p.LeftSurface = leftsurface
- p.RightSurface = rightsurface
- p.TopSurface = topsurface
- p.Transparency = transparency
- if p.Transparency>0.285 then
- p.Anchored = false
- else
- p.Anchored=true
- p.Material='Wood'
- end
- p.CFrame = cframe
- p.Reflectance = reflectance
- end
- --p:MakeJoints()
- -- m.Text = m.Text+1
- return --stop the function
- end
- local mody = math.random(-125,125)/1000 --some randomization
- for y = 1,yi do
- if math.random()> 0.5 then
- local modx = math.random(-125,125)/1000
- for x = 1,xi do
- local modz = math.random(-125,125)/1000
- for z = 1,zi do --offset = x/xi-0.75+modx)
- fragmentate(cframe*CFrame.new(size.X*(xi==1 and 0 or x/xi-0.75+modx),size.Y*(yi==1 and 0 or y/yi-0.75+mody),size.Z*(zi==1 and 0 or z/zi-0.75+modz)), --maths
- Vector3.new(xi == 2 and size.X*(1-2*math.abs(x/xi-0.75+modx)) or size.X,yi == 2 and size.Y*(1-2*math.abs(y/yi-0.75+mody)) or size.Y,
- zi == 2 and size.Z*(1-2*math.abs(z/zi-0.75+modz)) or size.Z or agent767_was_here),color,explosion_position,explosion_blastradius,
- z~=zi and surface_between_splitted_parts or backsurface,y==2 and surface_between_splitted_parts or bottomsurface,
- z==2 and surface_between_splitted_parts or frontsurface,x==2 and surface_between_splitted_parts or leftsurface,x~=xi and surface_between_splitted_parts or rightsurface,
- y~=yi and surface_between_splitted_parts or topsurface,transparency,reflectance)
- end
- end
- else
- local modz = math.random(-125,125)/1000
- for z = 1,zi do
- local modx = math.random(-125,125)/1000
- for x = 1,xi do
- fragmentate(cframe*CFrame.new(size.X*(xi==1 and 0 or x/xi-0.75+modx),size.Y*(yi==1 and 0 or y/yi-0.75+mody),size.Z*(zi==1 and 0 or z/zi-0.75+modz)),
- Vector3.new(xi == 2 and size.X*(1-2*math.abs(x/xi-0.75+modx)) or size.X,yi == 2 and size.Y*(1-2*math.abs(y/yi-0.75+mody)) or size.Y,
- zi == 2 and size.Z*(1-2*math.abs(z/zi-0.75+modz)) or size.Z),color,explosion_position,explosion_blastradius,
- z~=zi and surface_between_splitted_parts or backsurface,y==2 and surface_between_splitted_parts or bottomsurface,
- z==2 and surface_between_splitted_parts or frontsurface,x==2 and surface_between_splitted_parts or leftsurface,x~=xi and surface_between_splitted_parts or rightsurface,
- y~=yi and surface_between_splitted_parts or topsurface,transparency,reflectance)
- end
- end
- end
- end
- end
- function start_fragmentation(position,radius)
- local search = Region3.new(position-Vector3.new(radius,radius,radius)*1.1,position+Vector3.new(radius,radius,radius)*1.1)
- repeat
- local finish = false
- local parts = workspace:FindPartsInRegion3WithIgnoreList(search,list,100) --maximum number of parts that FindPartsInRegion3 can find is 100, so we have to do this to find them all
- for i = 1,#parts do
- table.insert(list,1,parts[i])
- end
- finish = true
- until #parts < 100 and finish
- print(#list)
- local t = tick()
- for i = 1,#list do
- local p = list[i]
- if p:IsDescendantOf(fragmentable) and p:GetMass()<3000 and p.Transparency>0.285 and p.Name~='Base' and p:IsDescendantOf(ch)==false then
- fragmentate(p.CFrame,p.Size,p.BrickColor,position,radius,p.BackSurface,p.BottomSurface,p.FrontSurface,p.LeftSurface,p.RightSurface,p.TopSurface,p.Transparency,p.Reflectance)
- if #storage < maximumstorage and p.Shape == "Block" then --recycle them
- p.Anchored = false
- p.FormFactor = "Custom"
- p.Size = stored_partsize
- p.Position = storage_position
- table.insert(storage,1,p)
- else --storage is full
- p:Destroy()
- end
- -- m.Text = m.Text-1
- end
- if p:IsDescendantOf(fragmentable) and p:GetMass()<53000 and p.Transparency<0.05 and p.Name~='Base' and tostring(p.Material)=='Enum.Material.Wood' and p:IsDescendantOf(ch)==false then
- fragmentate(p.CFrame,p.Size,p.BrickColor,position,radius,p.BackSurface,p.BottomSurface,p.FrontSurface,p.LeftSurface,p.RightSurface,p.TopSurface,p.Transparency,p.Reflectance)
- if #storage < maximumstorage and p.Shape == "Block" then --recycle them
- p.Anchored = true
- p.Material='Wood'
- p.FormFactor = "Custom"
- p.Size = stored_partsize
- p.Position = storage_position
- table.insert(storage,1,p)
- else --storage is full
- p:Destroy()
- end
- -- m.Text = m.Text-1
- end
- end
- list = {}
- -- print(tick()-t)
- end
- --[[
- spawn(function()
- while wait() do --oh noes,a loop! So inefficient!
- if #storage < fillup then
- for i = 1, parts_created_per_frame do --creates parts to fill up the storage
- local p = Instance.new("Part",fragmentable)
- p.Anchored = false
- p.FormFactor = "Custom"
- p.Size = stored_partsize
- p.Position = storage_position
- table.insert(storage,1,p)
- end
- end
- end
- end)
- ]]
- --local blankn=22416261
- --172121567
- crosshairs={
- {38140824};
- {38140833};
- {38140839};
- {38140843};
- {38140852};
- {38140910};
- {38140915};
- {38140923};
- {38140928};
- {38140931};
- {38208259};
- {38208275};
- {38208284};
- {38208303};
- {38208310};
- {38208325};
- {38208330};
- {38208352};
- {38208359};
- {38208377}
- }
- bulletholes={
- 172274695;
- 172274721
- }
- for _,v in pairs(crosshairs) do
- game:service'ContentProvider':Preload('rbxassetid://' .. tostring(v[1]-1))
- end
- currentIco=2
- switchIco=function(num)
- if num<20 then
- else
- num=20
- end
- mouse.Icon='rbxassetid://' .. tostring(crosshairs[num][1]-1)
- currentIco=num
- end
- switchIco(currentIco)
- heldDown=false
- spreadint=1
- --[[Settings]]--
- recoil=false -- Set to true for added realism
- magCapacity=20 -- How much a magazine can hold at once
- magAmmo=20 -- How much ammo is in the mag
- crosshairSpread=5
- spread=1
- pAmmunition=true -- more damage if true
- jamRate=500 -- How often the gun jams(the more the less) (no less than 1)
- primaryColor='Really black'
- secondaryColor='Really black'
- slideReflectance=0.01
- slideMaterial='Plastic'
- --[[Attachments]]--
- silencer=true
- highCapMag=false -- High capacity magazine
- laser=true
- automatic=false
- grip=true
- getSound=function(id)
- game:service'ContentProvider':Preload('rbxassetid'..tostring(id))
- local s=int("Sound",ch.Head)
- s.SoundId='rbxassetid://' .. tostring(id)
- s.Volume=1
- return s
- end
- local fireSound=getSound(151997297--[[10209842]])
- fireSound.Pitch=1.3
- --1.8
- local releaseSound=getSound(10209813)
- releaseSound.Pitch=4
- local reloadSound=getSound(10209636)
- reloadSound.Pitch=3
- local magazinelockSound=getSound(152206337)
- magazinelockSound.Pitch=1.4
- local slideBackSound=getSound(152206263)
- slideBackSound.Pitch=2.5
- local slideForwardSound=getSound(152206302)
- slideForwardSound.Pitch=2.5
- local emptySound=getSound(2697295)
- emptySound.Pitch=5
- local glassBreakSound=getSound(144884907)
- local woodImpact=getSound(142082171)
- local fleshImpact=getSound(144884872)
- fleshImpact.Pitch=1.7
- if ch:findFirstChild("Tec-99") then
- ch['Tec-99']:Destroy()
- end
- local tube=int("Model",ch)
- tube.Name='Tec-99'
- local hopper=Instance.new('HopperBin',plr.Backpack)
- hopper.Name=tube.Name
- Weld = function(p0,p1,x,y,z,rx,ry,rz,par)--recommend to use this with my weld. use this function only with arm lockers.
- p0.Position = p1.Position
- local w = Instance.new('Motor',par or p0)
- w.Part0 = p1
- w.Part1 = p0
- w.C0 = CFrame.new(x or 0,y or 0,z or 0)*CFrame.Angles(rx or 0,ry or 0,rz or 0)
- w.MaxVelocity = .1
- return w
- end
- function clerp(c1,c2,sp)
- local R1,R2,R3 = c1:toEulerAnglesXYZ()
- local R21,R22,R23 = c2:toEulerAnglesXYZ()
- return CFrame.new(
- c1.X + (c2.X-c1.X)*sp,
- c1.Y + (c2.Y-c1.Y)*sp,
- c1.Z + (c2.Z-c1.Z)*sp)*CFrame.Angles(
- R1 + (R21-R1)*sp,
- R2 + (R22-R2)*sp,
- R3 + (R23-R3)*sp
- )
- end
- tweenTable={}
- Tween = function(Weld, Stop, Step,a)
- ypcall(function()
- local func = function()
- local Start = Weld.C1
- local X1, Y1, Z1 = Start:toEulerAnglesXYZ()
- local Stop = Stop
- local X2, Y2, Z2 = Stop:toEulerAnglesXYZ()
- if not Step then Step=0.1 end
- table.insert(tweenTable,{th=0,Weld=Weld,Step=Step,Start=Start,X1=X1,Y1=Y1,Z1=Z1,Stop=Stop,X2=X2,Y2=Y2,Z2=Z2})
- end
- if a then coroutine.wrap(func)() else func() end
- end)
- end
- weld=function(p0,p1,c0)
- local w=Instance.new("Weld",p0)
- w.Part0=p0
- w.Part1=p1
- w.C0=c0
- return w
- end
- cp=function(parent,color,size,anchored,cancollide)
- local newp=Instance.new("Part",parent)
- newp.TopSurface='SmoothNoOutlines'
- newp.BottomSurface='SmoothNoOutlines'
- newp.FrontSurface='SmoothNoOutlines'
- newp.BackSurface='SmoothNoOutlines'
- newp.RightSurface='SmoothNoOutlines'
- newp.LeftSurface='SmoothNoOutlines'
- newp.FormFactor="Custom"
- newp.BrickColor=bc(color)
- newp.Size=size
- newp.Anchored=anchored
- newp.CanCollide=cancollide
- newp:BreakJoints()
- return newp
- end
- initializeJoints=function()
- rabr = cp(tube,'White',Vector3.new(1,1,1),false,false) rabr.Transparency = 1 rabr.Name='Locker'
- rabr.Position = torso.Position
- rw = Weld(rabr,torso,1.5,.5,0,0,0,0) rw.Parent = tube rw.Name = 'rw'
- w = Instance.new("Weld",tube)
- w.Part0,w.Part1 = ch['Right Arm'],rabr
- w.C1 = CFrame.new(0,-.5,0)
- labr = cp(tube,'White',Vector3.new(1,1,1),false,false) labr.Transparency = 1 labr.Name='Locker'
- labr.Position = torso.Position
- lw = Weld(labr,torso,-1.5,.5,0,0,0,0) lw.Parent = tube lw.Name = 'lw'
- ww = Instance.new("Weld",tube)
- ww.Part0,ww.Part1 = ch['Left Arm'],labr
- ww.C1 = CFrame.new(0,-.5,0)
- end
- initializeJoints()
- --[[ leg locks
- rabl = cp(tube,'White',Vector3.new(1,1,1),false,false) rabl.Transparency = 1 rabl.Name='Locker'
- rabl.Position = torso.Position
- rwl = Weld(rabl,torso,0.5,-1.5,0,0,0,0) rwl.Parent = tube rwl.Name = 'rwl'
- wl = Instance.new("Weld",tube)
- wl.Part0,wl.Part1 = ch['Right Leg'],rabl
- wl.C1 = CFrame.new(0,-.5,0)
- labl = cp(tube,'White',Vector3.new(1,1,1),false,false) labl.Transparency = 1 labl.Name='Locker'
- labl.Position = torso.Position
- lwl = Weld(labl,torso,-0.5,-1.5,0,0,0,0) lwl.Parent = tube lwl.Name = 'lwl'
- wwl = Instance.new("Weld",tube)
- wwl.Part0,wwl.Part1 = ch['Left Leg'],labl
- wwl.C1 = CFrame.new(0,-.5,0)
- ]]
- --weld(ch['HumanoidRootPart'],torso,cfn())
- local counter=Instance.new('ScreenGui',plr.PlayerGui)
- local frame=Instance.new('Frame',counter)
- frame.Size=UDim2.new(0.25,0,0.3,0)
- frame.Position=UDim2.new(0.1,0,0.4,0)
- frame.BackgroundTransparency=1
- local ammocounter=Instance.new('TextLabel',frame)
- ammocounter.Size=UDim2.new(1,0,0.3,0)
- ammocounter.Position=UDim2.new(0,0,0.2,0)
- ammocounter.BackgroundTransparency=1
- ammocounter.TextColor3=BrickColor.new('White').Color
- ammocounter.Font='SourceSansBold'
- ammocounter.FontSize='Size18'
- ammocounter.Text=''
- ammocounter.TextXAlignment='Left'
- local bg = Instance.new("BodyGyro",rootpart)
- bg.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
- bg.P = 10000
- bg.D = 100
- cyl=function(prt)
- local c=int("CylinderMesh",prt)
- return c
- end
- blo=function(prt)
- local c=int("BlockMesh",prt)
- return c
- end
- if laser then
- aLaser=cp(tube,'Really red',Vector3.new(0.2,0.2,0.2))
- aLaser.Transparency=1
- cyl(aLaser).Scale=Vector3.new(0.25,1,0.25)
- aLaser.Anchored=true
- end
- local handle=cp(tube,primaryColor,Vector3.new(0.2,0.6,0.3))
- blo(handle).Scale=Vector3.new(1.15,0.9,1)
- local mw=weld(ch['Right Arm'],handle,cfn(-0.4,-1,-0.19)*ang(mr(-101.5),0,0)*cfn()*ang(0,mr(-30),mr(-5)))
- local framepiece1=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.9))
- blo(framepiece1).Scale=Vector3.new(1.15,0.5,1)
- weld(handle,framepiece1,cfn(0,0.354,-0.3)*ang(mr(11.5),0,0))
- local barrel=cp(tube,'Medium stone grey',Vector3.new(0.2,0.2,0.2))
- cyl(barrel).Scale=Vector3.new(0.7,1.2,0.7)
- weld(framepiece1,barrel,cfn(0,0.15,-0.1)*ang(mr(-90),0,0))
- local sbarrel=cp(tube,'Really black',Vector3.new(0.2,0.3,0.2))
- cyl(sbarrel).Scale=Vector3.new(0.7,1.5,0.7)
- weld(barrel,sbarrel,cfn(0,0.35,0))
- local hole=cp(tube,'White',Vector3.new(0.2,0.2,0.2))
- hole.Transparency=1
- weld(sbarrel,hole,cfn(0,0.2,0))
- local flash=int('PointLight',hole)
- flash.Enabled=false
- flash.Range=10
- flash.Color=BrickColor.new('Neon orange').Color
- local slide1=cp(tube,secondaryColor,Vector3.new(0.2,0.2,0.4))
- slide1.CanCollide=false
- blo(slide1).Scale=Vector3.new(0.7,1,1.1)
- slideweld1=weld(framepiece1,slide1,cfn(0,0.15,0.23))
- slide1.Reflectance=slideReflectance
- slide1.Material=slideMaterial
- local slide2=cp(tube,secondaryColor,Vector3.new(0.2,0.2,0.4))
- slide2.CanCollide=false
- blo(slide2).Scale=Vector3.new(0.7,1,1.1)
- slideweld2=weld(slide1,slide2,cfn(0,0,-0.666))
- slide2.Reflectance=slideReflectance
- slide2.Material=slideMaterial
- local slideside1=cp(tube,secondaryColor,Vector3.new(0.2,0.2,1.1))
- slideside1.CanCollide=true
- blo(slideside1).Scale=Vector3.new(0.25,1,1)
- weld(slide1,slideside1,cfn(-0.09,0,-0.335))
- slideside1.Reflectance=slideReflectance
- slideside1.Material=slideMaterial
- local slideside2=cp(tube,secondaryColor, Vector3.new(0.2,0.2,0.4))
- slideside2.CanCollide=true
- blo(slideside2).Scale=Vector3.new(0.25,1,1.1)
- weld(slide1,slideside2,cfn(0.09,0,0))
- slideside2.Reflectance=slideReflectance
- slideside2.Material=slideMaterial
- local slideside3=cp(tube,secondaryColor, Vector3.new(0.2,0.2,0.3))
- slideside3.CanCollide=true
- blo(slideside3).Scale=Vector3.new(0.25,0.6,0.78)
- weld(slideside2,slideside3,cfn(0,-0.04,-0.335))
- slideside3.Reflectance=slideReflectance
- slideside3.Material=slideMaterial
- local slideside4=cp(tube,secondaryColor, Vector3.new(0.2,0.2,0.4))
- blo(slideside4).Scale=Vector3.new(0.25,1,1.1)
- weld(slide2,slideside4,cfn(0.09,0,0))
- slideside4.Reflectance=slideReflectance
- slideside4.Material=slideMaterial
- local mgs=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.2))
- blo(mgs).Scale=Vector3.new(1.15,0.425,0.245)
- weld(handle,mgs,cfn(0,-0.3,0.125))
- --[[Trigger]]--
- local tp1=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.2))
- blo(tp1).Scale=Vector3.new(0.6,0.1,0.8)
- weld(framepiece1,tp1,cfn(0,-0.22,0.13))
- local tp2=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.2))
- blo(tp2).Scale=Vector3.new(0.6,0.1,1.19)
- weld(framepiece1,tp2,cfn(0,-0.14,-0.0265)*ang(mr(45),0,0))
- local trigger1=cp(tube,'Really black',Vector3.new(0.2,0.2,0.2))
- blo(trigger1).Scale=Vector3.new(0.3,0.4,0.16)
- weld(framepiece1,trigger1,cfn(0,-0.07,0.09))
- local trigger2=cp(tube,'Really black',Vector3.new(0.2,0.2,0.2))
- blo(trigger2).Scale=Vector3.new(0.3,0.3,0.16)
- weld(trigger1,trigger2,cfn(0,-0.06,-0.015)*ang(mr(30),0,0))
- --[[Magazine]]--
- local magh=cp(tube,'Really black',Vector3.new(0.2,0.5,0.2))
- blo(magh).Scale=Vector3.new(0.6,1,1)
- local magweld=weld(handle,magh,cfn(0,-0.025,0))
- local bottom=cp(tube,'Really black',Vector3.new(0.2,0.2,0.3))
- blo(bottom).Scale=Vector3.new(1.15,0.385,0.8)
- bottomweld=weld(magh,bottom,cfn(0,-0.28,-0.015))
- if highCapMag then
- magweld:Destroy()
- magh.Size=Vector3.new(0.2,0.7,0.2)
- magweld=weld(handle,magh,cfn(0,-0.125,0))
- bottomweld:Destroy()
- bottomweld=weld(magh,bottom,cfn(0,-0.38,-0.015))
- magCapacity=magCapacity+23
- magAmmo=magAmmo+23
- end
- --[[Sights]]--
- local backsight1=cp(tube,'Black',Vector3.new(0.2,0.2,0.2))
- blo(backsight1).Scale=Vector3.new(0.3,0.3,0.3)
- weld(slide1,backsight1,cfn(0.06,0.1,0.13))
- local backsight2=cp(tube,'Black',Vector3.new(0.2,0.2,0.2))
- blo(backsight2).Scale=Vector3.new(0.3,0.3,0.3)
- weld(slide1,backsight2,cfn(-0.06,0.1,0.13))
- local frontsight=cp(tube,'Black',Vector3.new(0.2,0.2,0.2))
- blo(frontsight).Scale=Vector3.new(0.3,0.3,0.3)
- weld(slide1,frontsight,cfn(0,0.1,-0.85))
- local dot1=cp(tube,'Lime green',Vector3.new(0.2,0.2,0.2))
- cyl(dot1).Scale=Vector3.new(0.1,0.31,0.1)
- weld(backsight1,dot1,cfn(0,0.014,0)*ang(mr(-90),0,0))
- local dot2=cp(tube,'Lime green',Vector3.new(0.2,0.2,0.2))
- cyl(dot2).Scale=Vector3.new(0.1,0.31,0.1)
- weld(backsight2,dot2,cfn(0,0.014,0)*ang(mr(-90),0,0))
- local dot3=cp(tube,'Lime green',Vector3.new(0.2,0.2,0.2))
- cyl(dot3).Scale=Vector3.new(0.1,0.31,0.1)
- weld(frontsight,dot3,cfn(0,0.014,0)*ang(mr(-90),0,0))
- local ba=cp(tube,secondaryColor,Vector3.new(0.2,0.2,0.2))
- blo(ba).Scale=Vector3.new(1.15,0.5,1)
- weld(framepiece1,ba,cfn(0,0,-0.55))
- ba.Reflectance=slideReflectance
- ba.Material=slideMaterial
- local weirdholethatpistolshave=cp(tube,'Really black', Vector3.new(0.2,0.2,0.2))
- cyl(weirdholethatpistolshave).Scale=Vector3.new(0.4,1.01,0.4)
- weld(ba,weirdholethatpistolshave,cfn(0,0,0)*ang(mr(-90),0,0))
- --[[Tactical Rails]]--
- local r1=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.2))
- blo(r1).Scale=Vector3.new(1.15,0.2,0.25)
- weld(framepiece1,r1,cfn(0,-0.05,-0.17))
- local r2=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.2))
- blo(r2).Scale=Vector3.new(1.15,0.2,0.25)
- weld(framepiece1,r2,cfn(0,-0.05,-0.27))
- local r3=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.2))
- blo(r3).Scale=Vector3.new(1.15,0.2,0.25)
- weld(framepiece1,r3,cfn(0,-0.05,-0.37))
- if laser then
- local base=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.3))
- blo(base).Scale=Vector3.new(1.15,1,1)
- weld(r2,base,cfn(0,-0.05,0))
- basehole=cp(tube,'White',Vector3.new(0.2,0.2,0.2))
- cyl(basehole).Scale=Vector3.new(0.4,0.4,0.4)
- weld(base,basehole,cfn(0,0,-0.13)*ang(mr(-90),0,0))
- end
- if silencer then
- local sil=cp(tube,'Really black',Vector3.new(0.2,0.3,0.2))
- fireSound.SoundId='rbxassetid://153230595'
- fireSound.Pitch=1
- cyl(sil).Scale=Vector3.new(0.94,1.8,0.94)
- weld(hole,sil,cfn(0,0.29,0))
- end
- if grip then
- local base=cp(tube,primaryColor,Vector3.new(0.2,0.2,0.3))
- blo(base).Scale=Vector3.new(1.15,1,1)
- weld(r2,base,cfn(0,-0.05,0))
- local hd=cp(tube,primaryColor,Vector3.new(0.2,0.6,0.2))
- cyl(hd)
- weld(base,hd,cfn(0,-0.3,0))
- crosshairSpread=3
- spreadint=spreadint-0.3
- end
- --[[Test Functions]]--
- local debounce=false
- local out=false
- local bs=false
- cockSlide=function() -- hahaha yes i know
- slideBackSound:Play()
- if magAmmo<1 and out==true and bs==false then
- wait()
- slideweld1.C0=slideweld1.C0*cfn(0,0,0.22)
- else
- for i=1,2 do
- wait()
- slideweld1.C0=slideweld1.C0*cfn(0,0,0.22)
- end
- end
- local ajar=false
- if magAmmo==1 then
- ajar=true
- end
- if magAmmo>0 then
- createShell()
- --magAmmo=magAmmo-1
- ammocounter.Text=''
- for i=1,magAmmo do
- ammocounter.Text=ammocounter.Text .. 'I'
- end
- end
- wait(0.15)
- slideForwardSound:Play()
- for i=1,2 do
- wait()
- slideweld1.C0=slideweld1.C0*cfn(0,0,-0.22)
- end
- if ajar==true then
- out=true
- slideweld1.C0=cfn(0,0.15,0.23)
- slideweld1.C0=slideweld1.C0*cfn(0,0,0.22)
- end
- end
- --fx
- local firefx=cp(tube,'Neon orange',Vector3.new(0.7,1.1,0.7))
- firefx.Transparency=1
- local mesh=Instance.new('SpecialMesh',firefx)
- mesh.MeshType='Sphere'
- firefx.Material='Neon'
- weld(hole,firefx,cfn(0,1,0))
- local smokefx=Instance.new('Smoke',hole)
- smokefx.Enabled=false
- barrel.CanCollide=true
- local oc = oc or function(...) return ... end
- function ragJoint(hit,r,d)
- Spawn(oc(function()
- d = d or 0
- local rpar,r0,r1 = r.Parent,r.Part0,r.Part1
- if d > 0 then wait(d) end
- local p = hit:Clone()
- p:BreakJoints()
- p:ClearAllChildren()
- p.FormFactor = "Custom"
- p.Size = p.Size/2
- p.Transparency = 1
- p.CanCollide = true
- p.Name = "Colliduh"
- p.Parent = hit
- local w = Instance.new("Weld",p)
- w.Part0 = hit
- w.Part1 = p
- w.C0 = CFrame.new(0,-p.Size.Y/2,0)
- local rot = Instance.new("Rotate",rpar)
- rot.Name = r.Name
- rot.Part0 = r0
- rot.Part1 = r1
- rot.C0 = r.C0
- rot.C1 = r.C1
- r0.Velocity = Vector3.new()
- r1.Velocity = Vector3.new()
- r:Destroy()
- end))
- end
- createShell=function()
- local shell=cp(tube,'Deep orange',Vector3.new(0.2,0.3,0.2))
- shell.CanCollide=true
- shell.Reflectance=0.3
- cyl(shell)
- shell.CFrame=barrel.CFrame*ang(mr(-90),0,0)
- magAmmo=magAmmo-1
- ammocounter.Text=''
- for i=1,magAmmo do
- ammocounter.Text=ammocounter.Text .. 'I'
- end
- game.Debris:AddItem(shell,3)
- end
- reloadPistol=function()
- local current=magAmmo
- Tween(lw,cfn())
- Tween(rw,cfn()*ang(mr(-102),0,0))
- wait(0.4)
- releaseSound:Play()
- bottom.Transparency=1
- magh.Transparency=1
- local mag1=magh:clone()
- mag1.Transparency=0
- mag1.Weld:Destroy''
- local mag2=bottom:clone()
- mag2.Transparency=0
- mag1:BreakJoints''
- mag2:BreakJoints''
- local bm1=mag1:clone()
- local bm2=mag2:clone()
- mag1.Parent=tube
- mag2.Parent=tube
- mag1.CFrame=magh.CFrame
- weld(mag1,mag2,cfn(0,-0.28,-0.015))
- magAmmo=0
- ammocounter.Text=''
- for i=1,magAmmo do
- ammocounter.Text=ammocounter.Text .. 'I'
- end
- wait()
- mag1.CanCollide=true
- mag2.CanCollide=true
- game.Debris:AddItem(mag1,2)
- game.Debris:AddItem(mag2,2)
- wait(0.1)
- Tween(lw,cfn()*ang(mr(25),0,0))
- bm1.Parent=tube
- bm2.Parent=tube
- weld(bm1,bm2,cfn(0,-0.28,-0.015))
- local fa=weld(ch['Left Arm'],bm1,cfn(0,-1.1,0)*ang(mr(-90),0,0))
- wait(0.1)
- Tween(lw,cfn(0,1.4,0)*ang(mr(-109),mr(60),mr(10)),0.07)
- wait(0.25)
- magazinelockSound:Play()
- wait()
- -- reloadSound:Play()
- fa:Destroy''
- bm1:Destroy''
- bm2:Destroy''
- bottom.Transparency=0
- magh.Transparency=0
- local totalcap=0
- if current<1 then --none in chamber reload
- --slideweld1.C0=cfn(0,0,0.45)
- Tween(rw,cfn(0,0.7,0)*ang(mr(-90),mr(-30),0))
- Tween(lw,cfn(0,0.7,0)*ang(mr(-115),mr(35),0))
- wait(0.1)
- spawn(function()
- cockSlide()
- end)
- Tween(lw,cfn(0,0.7,0)*ang(mr(-115),mr(55),0))
- wait(0.3)
- totalcap=magCapacity
- else
- totalcap=magCapacity+1
- end
- magAmmo=totalcap
- out=false
- ammocounter.Text=''
- for i=1,magAmmo do
- ammocounter.Text=ammocounter.Text .. 'I'
- end
- restorePosition()
- end
- firePistol=function()
- switchIco(currentIco+crosshairSpread)
- if not jammed and not out then
- spread=spread+spreadint
- end
- print(spread)
- fireSound.Pitch=math.random(math.random(fireSound.Pitch-0.2,fireSound.Pitch-0.1),math.random(fireSound.Pitch,fireSound.Pitch+0.1))
- if magAmmo>0 and jammed==false then
- local ajar=false
- if magAmmo==1 then
- ajar=true
- end
- user=ch
- local ray = Ray.new(hole.CFrame.p, ((m.Hit.p+Vector3.new(math.random(-spread,spread)/6.35,math.random(-spread,spread)/6.35,math.random(-spread,spread)/6.35) )- hole.CFrame.p).unit*300)
- local hit, position = game.Workspace:FindPartOnRay(ray, user)
- if hit then
- if hit.Transparency>0.285 and hit:GetMass()<3000 and hit.Parent.className~='Hat' then
- local temps=glassBreakSound:clone()
- temps.Parent=hit
- temps.Pitch=math.random(math.random(temps.Pitch-0.2,temps.Pitch-0.1),math.random(temps.Pitch,temps.Pitch+0.1))
- temps:Play''
- start_fragmentation(position,.25)
- end
- if tostring(hit.Material)=='Enum.Material.Wood' and hit.Transparency<0.05 then
- local temps=woodImpact:clone()
- temps.Volume=1
- temps.Pitch=math.random(math.random(temps.Pitch-0.2,temps.Pitch-0.1),math.random(temps.Pitch,temps.Pitch+0.1))
- temps.Parent=hit
- temps:Play''
- start_fragmentation(position,.15)
- end
- ypcall(function()
- if hit and hit.Parent and hit.Parent:findFirstChild'Humanoid' then
- local temps=fleshImpact:clone()
- temps.Parent=hit
- temps:Play()
- if hit.Name~='Head' then
- if pAmmunition==true then
- hit.Parent.Humanoid:TakeDamage(math.random(30,65))
- else
- hit.Parent.Humanoid:TakeDamage(math.random(10,24))
- end
- local guy=hit.Parent
- if guy.Name~='TheDarkRevenant' then
- for i,v in pairs(guy:GetChildren()) do
- if v.className=='Hat' then
- v.Handle:BreakJoints()
- end
- local r = guy.Torso:FindFirstChild(v.Name:gsub("Arm","Shoulder"):gsub("Leg","Hip"))
- if v:IsA("BasePart") and r then
- ragJoint(v,r,.1)
- elseif v:IsA("Humanoid") then
- spawn(function()
- wait(0.5)
- v.PlatformStand = true
- v.Changed:connect(function()
- v.PlatformStand = true
- end)
- end)
- end
- end
- end
- else
- if hit.Parent.Name~='TheDarkRevenant' then
- hit.Parent:BreakJoints()
- end
- end
- end
- if hit.Parent.className=='Hat' then
- hit.CanCollide=true
- hit:BreakJoints()
- hit.Velocity=m.Hit.p*5
- end
- end)
- end
- if m.Target then
- local p = Instance.new("Part")
- p.formFactor = "Custom"
- p.Size = Vector3.new(0.5,0.5,0.5)
- p.Transparency = 1
- p.CanCollide = false
- p.Locked = true
- p.CFrame = CFrame.new(position.x,position.y,position.z)--mouse.Target.CFrame+(mouse.Hit.p-mouse.Target.Position)
- local w = Instance.new("Weld")
- w.Part0 = mouse.Target
- w.Part1 = p
- w.C0 = mouse.Target.CFrame:inverse()
- w.C1 = p.CFrame:inverse()
- w.Parent = p
- local d = Instance.new("Decal")
- d.Parent = p
- d.Face = mouse.TargetSurface
- d.Texture = 'rbxassetid://' .. tostring(bulletholes[math.random(#bulletholes)]-2)
- p.Parent = tube
- game.Debris:AddItem(p,6)
- end
- if recoil==true then
- cam:SetRoll(math.random(-2,2))
- cam:TiltUnits(0.501)
- end
- local th=cp(tube,"Really black",Vector3.new(1,1,1))
- th.CanCollide=false
- th.Anchored=true
- th.CFrame=CFrame.new(position.x,position.y,position.z)
- local spm=Instance.new('SpecialMesh',th)
- spm.MeshType='Sphere'
- spm.Scale=Vector3.new(0.05,0.05,0.05)
- spawn(function()
- for i=1,5 do
- wait()
- spm.Scale=spm.Scale+Vector3.new(0.16,0.16,0.16)
- th.Transparency=th.Transparency+0.2
- end
- th:Destroy()
- end)
- fireSound:Play()
- spawn(function()
- firefx.Transparency=0
- wait()
- firefx.Transparency=1
- end)
- spawn(function()
- flash.Enabled=true
- for i=1,2 do
- wait()
- slideweld1.C0=slideweld1.C0*cfn(0,0,0.22)
- end
- flash.Enabled=false
- createShell()
- for i=1,2 do
- wait()
- slideweld1.C0=slideweld1.C0*cfn(0,0,-0.22)
- end
- slideweld1.C0=cfn(0,0.15,0.23)
- if ajar==true then
- out=true
- slideweld1.C0=cfn(0,0.15,0.23)
- slideweld1.C0=slideweld1.C0*cfn(0,0,0.22)
- end
- end)
- ammocounter.Text=''
- for i=1,magAmmo do
- ammocounter.Text=ammocounter.Text .. 'I'
- end
- wait()
- Tween(rw,cfn(0,0.7,0)*ang(mr(-100),mr(-30),0),0.62)
- if not grip then
- Tween(lw,cfn(0,0.7,0)*ang(mr(-100),mr(30),0),0.62)
- else
- Tween(lw,cfn(0,1.3,0)*ang(mr(-100),mr(30),0),0.62)
- end
- wait(0.065)
- restorePosition(0.3)
- else
- if magAmmo<1 then
- slideweld1.C0=cfn(0,0.15,0.23)
- slideweld1.C0=slideweld1.C0*cfn(0,0,0.22)
- end
- emptySound:Play()
- end
- if math.random(jamRate)==jamRate and magAmmo>0 then
- jammed=true
- end
- end
- debounced=function()
- if sheathed==false and debounce==false then
- return true
- end
- end
- mouse.Button1Down:connect(function()
- if debounced() then
- if automatic==false then
- debounce=true
- firePistol()
- debounce=false
- else
- heldDown=true
- firePistol()
- end
- end
- end)
- mouse.Button1Up:connect(function()
- heldDown=false
- end)
- sheathGun=function()
- ammocounter.Visible=false
- if laser then
- laserEnabled=false
- aLaser.Transparency=1
- end
- Tween(rw,cfn())
- Tween(lw,cfn())
- wait(0.1)
- mw:Destroy''
- mw=nil
- mw=weld(tor,handle,cfn(1.11,-1.09,0)*ang(mr(-111.5),0,0))
- labr:Destroy()
- rabr:Destroy()
- bg.maxTorque=Vector3.new()
- sheathed=true
- end
- unsheathGun=function()
- ammocounter.Visible=true
- mw:Destroy''
- mw=nil
- initializeJoints()
- mw=weld(ch['Right Arm'],handle,cfn(-0.4,-1,-0.19)*ang(mr(-101.5),0,0)*cfn()*ang(0,mr(-30),mr(-5)))
- restorePosition()
- bg.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
- sheathed=false
- end
- laserEnabled=false
- mouse.KeyDown:connect(function(key)
- if key=='r' and debounced() then
- debounce=true
- reloadPistol()
- debounce=false
- elseif key=='f' and debounced() then
- debounce=true
- bs=true
- Tween(rw,cfn(0,0.7,0)*ang(mr(-90),mr(-30),0))
- Tween(lw,cfn(0,0.7,0)*ang(mr(-115),mr(35),0))
- wait(0.1)
- spawn(function()
- cockSlide()
- end)
- Tween(lw,cfn(0,0.7,0)*ang(mr(-115),mr(55),0))
- wait(0.3)
- jammed=false
- restorePosition()
- bs=false
- debounce=false
- elseif key=='l' and debounced() then
- if not laserEnabled then
- laserEnabled=true
- aLaser.Transparency=0.35
- else
- laserEnabled=false
- aLaser.Transparency=1
- end
- end
- end)
- restorePosition=function(speed)
- if not grip then
- Tween(rw,cfn(0,0.7,0)*ang(mr(-90),mr(-30),0),speed)
- Tween(lw,cfn(0,0.7,0)*ang(mr(-90),mr(30),0),speed)
- else
- Tween(rw,cfn(0,0.7,0)*ang(mr(-90),mr(-30),0),speed)
- Tween(lw,cfn(0,1.3,0)*ang(mr(-90),mr(30),0),speed)
- end
- end
- hopper.Selected:connect(function()
- unsheathGun()
- end)
- hopper.Deselected:connect(function()
- sheathGun()
- end)
- game:service'RunService'.RenderStepped:connect(function()
- bg.cframe = CFrame.new(rootpart.Position,mouse.Hit.p*Vector3.new(1,0,1)+rootpart.Position*Vector3.new(0,1,0))
- if laserEnabled==true then
- local user=ch
- local ray = Ray.new(hole.CFrame.p, (m.Hit.p - hole.CFrame.p).unit*300)
- local hit, position = game.Workspace:FindPartOnRay(ray, user)
- local distance = (position - basehole.CFrame.p).magnitude
- aLaser.Size=Vector3.new(0.2,distance,0.2)
- aLaser.CFrame=CFrame.new(position, basehole.CFrame.p) * CFrame.new(0, 0, -distance/2) * ang(mr(-90),0,0)
- end
- for _,v in pairs(tweenTable) do
- if v.Weld.C1==v.Stop then
- table.remove(tweenTable,_)
- else
- if v.th<0.9 then
- v.th=v.th+v.Step
- i=v.th
- v.Weld.C1 = CFrame.new( (v.Start.p.X * (1 - i)) + (v.Stop.p.X * i),
- (v.Start.p.Y * (1 - i)) + (v.Stop.p.Y * i),
- (v.Start.p.Z * (1 - i)) + (v.Stop.p.Z * i)) * CFrame.fromEulerAnglesXYZ(
- (v.X1 * (1 - i)) + (v.X2 * i), (v.Y1 * (1 - i)) + (v.Y2 * i),
- (v.Z1 * (1 - i)) + (v.Z2 * i) )
- else
- v.Weld.C1 = v.Stop
- end
- end
- end
- end)
- for i=1,magAmmo do
- ammocounter.Text=ammocounter.Text .. 'I'
- end
- sheathGun()
- spawn(function()
- while wait(0.07) do
- if heldDown==true then
- spawn(function()
- firePistol()
- end)
- end
- end
- end)
- m.TargetFilter=tube
- while wait(0.03) do
- if spread>1 then
- spread=spread-spreadint/4
- end
- if spread<1 then
- spread=1
- end
- if currentIco>2 then
- switchIco(currentIco-1)
- end
- end
- --hl/https://httpget-inumeration.c9.io/mp45.lua
- --local/game.Players.Conmiro:Destroy''
- -- GPlayr by ModernLukest. Made for v3rmillion, , etc.
- -- Note that anyone can hear the music that you play. Just a clarification for what LocalScripts can do.
- local char = game.Players.LocalPlayer.Character
- -- CREATING BUTTONS, LABELS, FRAMES, ETC.
- local gui = Instance.new("ScreenGui", game.Players.LocalPlayer.PlayerGui) -- CoreGui is buggy, since GPlayr is designed for PlayerGuis, not CoreGuis.
- local openbtn = Instance.new("TextButton", gui)
- local closebtn = Instance.new("TextButton", gui)
- local openguibtn = Instance.new("TextButton", gui)
- local playmusicint = Instance.new("Frame", gui)
- local playmusicbtn = Instance.new("ImageButton", playmusicint)
- local stopmusicbtn = Instance.new("ImageButton", playmusicint)
- local musicidbox = Instance.new("TextBox", playmusicint)
- local credit = Instance.new("TextLabel", playmusicint)
- local title = Instance.new("TextLabel", playmusicint)
- -- SIZING --
- openbtn.Size = UDim2.new(0, 100, 0, 50)
- closebtn.Size = UDim2.new(0, 100, 0, 50)
- openguibtn.Size = UDim2.new(0, 100, 0, 50)
- playmusicbtn.Size = UDim2.new(0, 50, 0, 50)
- stopmusicbtn.Size = UDim2.new(0, 57, 0, 57)
- musicidbox.Size = UDim2.new(0, 300, 0, 50)
- credit.Size = UDim2.new(0, 300, 0, 20)
- title.Size = UDim2.new(0, 300, 0, 30)
- playmusicint.Size = UDim2.new(0, 300, 0, 500)
- -- POSITIONING --
- openbtn.Position = UDim2.new(0, 0, 0, 510)
- closebtn.Position = UDim2.new(0, 0, 0, 510)
- openguibtn.Position = UDim2.new(0, 0, 0, 590)
- playmusicbtn.Position = UDim2.new(0, 50, 0, 200)
- stopmusicbtn.Position = UDim2.new(0, 175, 0, 197)
- musicidbox.Position = UDim2.new(0, 0, 0, 100)
- credit.Position = UDim2.new(0, 0, 0, 470)
- title.Position = UDim2.new(0, 0, 0, 0)
- playmusicint.Position = UDim2.new(0, 200, 0, 100)
- -- SET TEXT --
- title.Text = "GPlayr (BETA)"
- credit.Text = "GPlayr & radio scripting by Developer / ModernLukest"
- musicidbox.Text = "Enter Sound ID Here"
- openbtn.Text = "Take Out Radio"
- closebtn.Text = "Put Away Radio"
- openguibtn.Text = "Open/Close Music GUI"
- -- SET IMAGE IDS --
- playmusicbtn.Image = "rbxassetid://499381047"
- stopmusicbtn.Image = "rbxassetid://499381006"
- -- BACKGROUND COLOR3 --
- playmusicint.BackgroundColor3 = Color3.new(136, 136, 136)
- openbtn.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- closebtn.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- openguibtn.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- musicidbox.BackgroundColor3 = Color3.fromRGB(109, 109, 109)
- -- BACKGROUND TRANSPARENCY --
- playmusicint.BackgroundTransparency = 0.9
- playmusicbtn.BackgroundTransparency = 1
- stopmusicbtn.BackgroundTransparency = 1
- musicidbox.BackgroundTransparency = 0.43
- credit.BackgroundTransparency = 1
- title.BackgroundTransparency = 1
- -- BORDER SIZE PIXEL --
- musicidbox.BorderSizePixel = 0
- openbtn.BorderSizePixel = 3
- closebtn.BorderSizePixel = 3
- openguibtn.BorderSizePixel = 3
- -- FONTS --
- musicidbox.Font = "SourceSansLight"
- credit.Font = "SourceSansLight"
- title.Font = "SourceSansLight"
- -- TEXT SCALED --
- credit.TextScaled = true
- title.TextScaled = true
- -- TEXT WRAPPED --
- musicidbox.TextWrapped = true
- credit.TextWrapped = true
- title.TextWrapped = true
- openguibtn.TextWrapped = true
- -- FONT SIZE --
- musicidbox.FontSize = "Size28"
- -- ACTIVE --
- playmusicint.Active = true
- -- DRAGGABLE --
- playmusicint.Draggable = true
- -- GUI FUNCTIONS (MAIN) --
- -- set up the stuff --
- isGuiOpen = false
- closebtn.Visible = false
- playmusicint.Visible = false
- openguibtn.Visible = false
- openbtn.MouseButton1Click:connect(function()
- openbtn.Visible = false
- closebtn.Visible = true
- local radio = Instance.new("Part", char)
- radio.Name = "Radio"
- local mesh = Instance.new("FileMesh", radio)
- mesh.MeshId = "http://www.roblox.com/asset/?id=212302951"
- mesh.TextureId = "http://www.roblox.com/asset/?id=212303049"
- mesh.Scale = Vector3.new(4, 4, 4)
- mesh.VertexColor = Vector3.new(1, 1, 1)
- mesh.Offset = Vector3.new(0, 0, 0)
- local function weldBetween(a, b)
- local weld = Instance.new("ManualWeld")
- weld.Part0 = a
- weld.Part1 = b
- weld.C0 = CFrame.new()
- weld.C1 = b.CFrame:inverse() * a.CFrame
- weld.Parent = a
- return weld;
- end
- local hand = radio:clone()
- hand.Parent=char
- hand.CFrame=char:WaitForChild("Torso").CFrame*CFrame.new(Vector3.new(0,0,0.9))*CFrame.Angles(0,math.rad(180),math.rad(45))
- weldBetween(char:WaitForChild("Torso"), hand)
- hand.CanCollide=true
- hand.Anchored=false
- sound = Instance.new("Sound", hand) -- we will now call the radio "hand"
- sound.Volume = 0.5
- sound.Pitch = 1
- openguibtn.Visible = true
- char:FindFirstChild("Radio"):Destroy()
- end)
- closebtn.MouseButton1Click:connect(function()
- openbtn.Visible = true
- closebtn.Visible = false
- openguibtn.Visible = false
- playmusicint.Visible = false
- isGuiOpen = false
- char:WaitForChild("Radio"):Destroy()
- end)
- playmusicbtn.MouseButton1Click:connect(function()
- sound:stop()
- wait(0.2)
- sound.SoundId = "rbxassetid://"..musicidbox.Text
- sound:play()
- end)
- stopmusicbtn.MouseButton1Click:connect(function()
- sound:stop()
- end)
- openguibtn.MouseButton1Click:connect(function()
- if isGuiOpen == false then isGuiOpen = true
- playmusicint.Visible = true else isGuiOpen = false playmusicint.Visible = false
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement