SHOW:
|
|
- or go back to the newest paste.
| 1 | local _CODE = "_NSword" | |
| 2 | ||
| 3 | --==================================================-VARIABLES-==================================================-- | |
| 4 | ||
| 5 | local player = game:GetService("Players").LocalPlayer
| |
| 6 | local char = player.Character | |
| 7 | local huma = char:FindFirstChild("Humanoid")
| |
| 8 | local initialized, disconnectRequest = false, false | |
| 9 | local model,suited,use,processing,animate,gtarget,gs = false,false,false,false,false,false,true | |
| 10 | local w,a,s,d = false,false,false,false | |
| 11 | local bindKeyDown,bindKeyUp = false,false | |
| 12 | local hit,trail,lighting,shirt,bin = false, false, false, false, false | |
| 13 | local bPos, bGyro = Instance.new("BodyPosition"), Instance.new("BodyGyro")
| |
| 14 | local delete = true | |
| 15 | local prt,_jnt,_mdl,_prt,_kup,_kdn,_mse,ms = {}
| |
| 16 | local combo = 0 | |
| 17 | local tol = 4 | |
| 18 | local mode = 0 | |
| 19 | local cfs = false | |
| 20 | local jumping = false | |
| 21 | local buttonDown = false | |
| 22 | local shirtColor = "Really black" | |
| 23 | local pantsColor = "Really black" | |
| 24 | local attachColor = "Really black" | |
| 25 | local sheathColor = "Really black" | |
| 26 | local swordHandleColor = "Really black" | |
| 27 | local gunColor = "Really black" | |
| 28 | local gunTakePos = nil | |
| 29 | local defaultWalkspeed = huma.WalkSpeed | |
| 30 | ||
| 31 | --==================================================-MAIN-CODE-==================================================-- | |
| 32 | ||
| 33 | bPos.maxForce = Vector3.new(0,math.huge,0) | |
| 34 | bGyro.maxTorque = Vector3.new(math.huge,math.huge,math.huge) | |
| 35 | ||
| 36 | if player == nil or char == nil then return end | |
| 37 | ||
| 38 | if not player.Backpack:FindFirstChild(_CODE) then | |
| 39 | bin = Instance.new("HopperBin")
| |
| 40 | bin.Name = _CODE | |
| 41 | bin.Parent = player:FindFirstChild("Backpack")
| |
| 42 | else bin = player.Backpack[_CODE] end | |
| 43 | ||
| 44 | if bin ~= nil then | |
| 45 | script.Name = "_NScript" | |
| 46 | script.Parent = nil | |
| 47 | end | |
| 48 | ||
| 49 | local part = {
| |
| 50 | head = char:FindFirstChild("Head"),
| |
| 51 | tors = char:FindFirstChild("Torso"),ftor,
| |
| 52 | larm = char:FindFirstChild("Left Arm"),
| |
| 53 | rarm = char:FindFirstChild("Right Arm"),
| |
| 54 | lleg = char:FindFirstChild("Left Leg"),
| |
| 55 | rleg = char:FindFirstChild("Right Leg")}
| |
| 56 | ||
| 57 | local motor = {
| |
| 58 | neck = part.tors:FindFirstChild("Neck"),
| |
| 59 | lsho = part.tors:FindFirstChild("Left Shoulder"),
| |
| 60 | rsho = part.tors:FindFirstChild("Right Shoulder"),
| |
| 61 | lhip = part.tors:FindFirstChild("Left Hip"),
| |
| 62 | rhip = part.tors:FindFirstChild("Right Hip")}
| |
| 63 | ||
| 64 | for i,obj in pairs(char:GetChildren()) do | |
| 65 | if obj:IsA("CharacterMesh") then
| |
| 66 | obj:Destroy() | |
| 67 | end | |
| 68 | end | |
| 69 | ||
| 70 | function JoinInit() | |
| 71 | while processing do wait() end | |
| 72 | processing = true | |
| 73 | if char:FindFirstChild("Shirt") then
| |
| 74 | shirt = char.Shirt | |
| 75 | shirt.Parent = nil | |
| 76 | end | |
| 77 | part.ftor = part.tors:Clone() | |
| 78 | part.ftor.Name = "_Torso2" | |
| 79 | part.ftor.BrickColor = BrickColor.new("Really black")
| |
| 80 | local joint = {neck,tors,lsho,rsho,lhip,rhip}
| |
| 81 | joint.tors = Instance.new("Weld", part.tors)
| |
| 82 | joint.tors.Name = "Torso_WELD" | |
| 83 | joint.tors.Part0 = part.tors | |
| 84 | joint.tors.Part1 = part.ftor | |
| 85 | part.ftor.Parent = char | |
| 86 | part.tors.Transparency = 1 | |
| 87 | for i,join in pairs (motor) do | |
| 88 | local weld | |
| 89 | if not join.Parent:FindFirstChild(join.Name.."_WELD") then | |
| 90 | weld = Instance.new("Weld", join.Parent)
| |
| 91 | weld.Name = join.Name.."_WELD" | |
| 92 | else weld = join.Parent[join.Name.."_WELD"] end | |
| 93 | if tostring(i) == "lsho" then | |
| 94 | weld.C0 = CFrame.new(-1.5,0.5,0) | |
| 95 | weld.C1 = CFrame.new(0,0.5,0) | |
| 96 | elseif tostring(i) == "rsho" then | |
| 97 | weld.C0 = CFrame.new(1.5,0.5,0) | |
| 98 | weld.C1 = CFrame.new(0,0.5,0) | |
| 99 | elseif tostring(i) == "neck" then | |
| 100 | weld.C0 = CFrame.new(0,1,0) | |
| 101 | weld.C1 = CFrame.new(0,-0.5,0) | |
| 102 | else | |
| 103 | weld.C0 = join.C0 | |
| 104 | weld.C1 = join.C1 | |
| 105 | end | |
| 106 | weld.Part1 = join.Part1 | |
| 107 | if tostring(i) ~= "neck" then | |
| 108 | join.Part0 = part.ftor | |
| 109 | else | |
| 110 | weld.Part0 = part.ftor | |
| 111 | end | |
| 112 | joint[i] = weld | |
| 113 | end | |
| 114 | initialized = true | |
| 115 | processing = false | |
| 116 | return joint | |
| 117 | end | |
| 118 | ||
| 119 | function Bind(join) | |
| 120 | if join == nil then return end | |
| 121 | if _jnt == nil then return end | |
| 122 | if part.ftor == nil then return end | |
| 123 | if not _jnt[join]:IsA("Weld") then return end
| |
| 124 | if not motor[join]:IsA("Motor6D") then return end
| |
| 125 | motor[join].Part0 = nil | |
| 126 | _jnt[join].Part0 = part.ftor | |
| 127 | end | |
| 128 | ||
| 129 | function Release(join) | |
| 130 | if join == nil then return end | |
| 131 | if _jnt == nil then return end | |
| 132 | if part.ftor == nil then return end | |
| 133 | if not _jnt[join]:IsA("Weld") then return end
| |
| 134 | if not motor[join]:IsA("Motor6D") then return end
| |
| 135 | _jnt[join].Part0 = nil | |
| 136 | motor[join].Part0 = part.ftor | |
| 137 | end | |
| 138 | ||
| 139 | function SuitInit() | |
| 140 | while processing do wait() end | |
| 141 | processing = true | |
| 142 | if initialized then | |
| 143 | local suitModel | |
| 144 | if not char:FindFirstChild(_CODE.." Suit") then | |
| 145 | suitModel = Instance.new("Model", char)
| |
| 146 | suitModel.Name = _CODE.." Suit" | |
| 147 | model = true | |
| 148 | else suitModel = char[_CODE.." Suit"] model = true end | |
| 149 | processing = false | |
| 150 | return suitModel | |
| 151 | else processing = false end | |
| 152 | end | |
| 153 | ||
| 154 | function CF(join,cf,rot,speed,ctin,s) | |
| 155 | if s and cfs then ctin = true animate = false return end | |
| 156 | if join == nil then return end | |
| 157 | local def,done = join.C0,false | |
| 158 | local cf = cf or def | |
| 159 | local rot = rot or (def - def.p) | |
| 160 | local speed = speed or 1 | |
| 161 | local x1,y1,z1 = def:toEulerAnglesXYZ() | |
| 162 | local x2,y2,z2 = rot:toEulerAnglesXYZ() | |
| 163 | coroutine.wrap(function() | |
| 164 | if speed ~= 1 then | |
| 165 | for i = 0,1,speed do | |
| 166 | if s and cfs then ctin = true animate = false return end | |
| 167 | join.C0 = CFrame.new( | |
| 168 | (def.p.X * (1 - i) + cf.p.X * i), | |
| 169 | (def.p.Y * (1 - i) + cf.p.Y * i), | |
| 170 | (def.p.Z * (1 - i) + cf.p.Z * i)) * | |
| 171 | CFrame.fromEulerAnglesXYZ( | |
| 172 | (x1 * (1 - i) + x2 * i), | |
| 173 | (y1 * (1 - i) + y2 * i), | |
| 174 | (z1 * (1 - i) + z2 * i)) | |
| 175 | wait(0.015) | |
| 176 | end | |
| 177 | end if s and cfs then ctin = true animate = false else join.C0 = CFrame.new(cf.p) * CFrame.fromEulerAnglesXYZ(x2,y2,z2) end done = true | |
| 178 | end)() | |
| 179 | if not ctin and speed ~= 1 then while not done do wait(0.015) end end | |
| 180 | end | |
| 181 | ||
| 182 | function CreatePart(tab, name, color, transparency, reflectance, size, cframe, rotation, cancollide, anchored, meshType, scaleSize, weldPart, parent) | |
| 183 | if model and _mdl ~= nil and part.ftor ~= nil then | |
| 184 | local returnTable = {part,weld}
| |
| 185 | if scaleSize == nil then scaleSize = false end | |
| 186 | local suitPart = Instance.new("Part")
| |
| 187 | suitPart.Name = name | |
| 188 | suitPart.BrickColor = BrickColor.new(color) | |
| 189 | suitPart.Anchored = anchored | |
| 190 | suitPart.Locked = true | |
| 191 | suitPart.CanCollide = cancollide | |
| 192 | suitPart.Transparency = transparency | |
| 193 | suitPart.Reflectance = reflectance | |
| 194 | suitPart.FormFactor = Enum.FormFactor.Custom | |
| 195 | suitPart.BottomSurface = "Smooth" | |
| 196 | suitPart.TopSurface = "Smooth" | |
| 197 | suitPart.Size = size | |
| 198 | if meshType ~= nil then | |
| 199 | if meshType == "Cone" then | |
| 200 | CreateMesh("http://www.roblox.com/asset/?id=1033714", suitPart, scaleSize)
| |
| 201 | elseif meshType == "Corner" then | |
| 202 | CreateMesh("http://www.roblox.com/asset/?id=11294911", suitPart, scaleSize)
| |
| 203 | elseif meshType == "Devo" then | |
| 204 | CreateMesh("http://www.roblox.com/asset/?id=15720044", suitPart, scaleSize)
| |
| 205 | elseif meshType == "Diamond" then | |
| 206 | CreateMesh("http://www.roblox.com/asset/?id=9756362", suitPart, scaleSize)
| |
| 207 | elseif meshType == "Ring" then | |
| 208 | CreateMesh("http://www.roblox.com/asset/?id=3270017", suitPart, scaleSize)
| |
| 209 | elseif meshType == "Tetrahedron" then | |
| 210 | CreateMesh("http://www.roblox.com/asset/?id=11294922", suitPart, scaleSize)
| |
| 211 | elseif meshType == "Crown" then | |
| 212 | CreateMesh("http://www.roblox.com/asset/?id=20329976", suitPart, scaleSize)
| |
| 213 | elseif meshType == "Claws" then | |
| 214 | CreateMesh("http://www.roblox.com/asset/?id=10681506", suitPart, scaleSize)
| |
| 215 | elseif meshType == "Cylinder" then | |
| 216 | local mesh = Instance.new("CylinderMesh", suitPart)
| |
| 217 | if scaleSize then mesh.Scale = suitPart.Size end | |
| 218 | elseif meshType == "Brick" then | |
| 219 | local mesh = Instance.new("BlockMesh", suitPart)
| |
| 220 | if scaleSize then mesh.Scale = suitPart.Size end | |
| 221 | else | |
| 222 | local mesh = Instance.new("SpecialMesh", suitPart)
| |
| 223 | if scaleSize then mesh.Scale = suitPart.Size end | |
| 224 | mesh.MeshType = meshType | |
| 225 | end | |
| 226 | end | |
| 227 | if weldPart == nil then suitPart.CFrame = cframe * rotation else | |
| 228 | local weld = Instance.new("Weld", _mdl)
| |
| 229 | weld.Part1 = suitPart | |
| 230 | weld.Part0 = weldPart | |
| 231 | weld.Name = tostring(weld.Part0).."_TO_"..tostring(weld.Part1) | |
| 232 | weld.C0 = cframe * rotation | |
| 233 | returnTable.weld = weld | |
| 234 | end | |
| 235 | returnTable.part = suitPart | |
| 236 | suitPart.Parent = parent or _mdl | |
| 237 | if tab ~= nil then tab[name] = returnTable else return returnTable end | |
| 238 | end | |
| 239 | end | |
| 240 | ||
| 241 | function CreateMesh(id, part, scaleSize) | |
| 242 | local mesh = Instance.new("SpecialMesh", part)
| |
| 243 | if scaleSize then mesh.Scale = part.Size end | |
| 244 | mesh.MeshType = Enum.MeshType.FileMesh | |
| 245 | mesh.MeshId = id | |
| 246 | return mesh | |
| 247 | end | |
| 248 | ||
| 249 | function LoadSuit() | |
| 250 | while processing do wait() end | |
| 251 | processing = true | |
| 252 | if not suited then | |
| 253 | CreatePart(prt, "torso_1", shirtColor, 0, 0, Vector3.new(2.015,2.11,1.015), CFrame.new(0,-0.04,0), CFrame.Angles(0,0,0),false,false, "Brick",false,part.ftor) | |
| 254 | CreatePart(prt, "torso_2", attachColor, 0, 0, Vector3.new(2.70,0.2,1.06), CFrame.new(-0.05,0.125,0), CFrame.Angles(0,0,math.rad(45)),false,false, "Brick",false,prt.torso_1.part) | |
| 255 | CreatePart(prt, "torso_3", attachColor, 0, 0, Vector3.new(2.15,0.2,1.06), CFrame.new(-0.025,-0.9,0), CFrame.Angles(0,0,math.rad(-2)),false,false, "Brick",false,prt.torso_1.part) | |
| 256 | CreatePart(prt, "torso_4", "Pastel Blue", 0, 1, Vector3.new(0.3,0.2,0.3), CFrame.new(0.6,0,-0.45), CFrame.Angles(math.rad(90),0,0),false,false, "Cylinder",false,prt.torso_3.part) | |
| 257 | CreatePart(prt, "arm_1", shirtColor, 0, 0, Vector3.new(1.015,0.8,1.015), CFrame.new(0,0.615,0), CFrame.Angles(0,0,0),false,false, "Brick",false,part.rarm) | |
| 258 | CreatePart(prt, "arm_2", shirtColor, 0, 0, Vector3.new(1.015,1.6,1.015), CFrame.new(0,0.215,0), CFrame.Angles(0,0,0),false,false, "Brick",false,part.larm) | |
| 259 | CreatePart(prt, "sheath_1", sheathColor, 0, 0, Vector3.new(0.425,4.5,0.2), CFrame.new(-0.25,0,0.63), CFrame.Angles(0,0,math.rad(-90)),false, false,"Brick", false, prt.torso_2.part) | |
| 260 | CreatePart(prt, "sheath_2", sheathColor, 0, 0,Vector3.new(0.21,0.6,0.415),CFrame.new(0,-2.55,0),CFrame.Angles(0,math.rad(90),math.rad(180)),false,false,"Wedge",false,prt.sheath_1.part) | |
| 261 | CreatePart(prt, "sheath_3", "Bright red", 0, 0,Vector3.new(0.25,0.6,0.2),CFrame.new(0,1.8,0.05),CFrame.Angles(0,0,0),false,false,"Diamond",true,prt.sheath_1.part) | |
| 262 | CreatePart(prt, "sheath_4", "Really black", 0, 0.3,Vector3.new(0.2,0.6,0.2),CFrame.new(0,1.3,0.1),CFrame.Angles(0,0,math.rad(27)),false,false,"Brick",true,prt.sheath_1.part) | |
| 263 | CreatePart(prt, "sheath_5", "Pastel Blue", 0, 0.3,Vector3.new(0.2,0.6,0.2),CFrame.new(0,1.1,0.1),CFrame.Angles(0,0,math.rad(27)),false,false,"Brick",true,prt.sheath_1.part) | |
| 264 | CreatePart(prt, "sheath_6", "Really black", 0, 0.3,Vector3.new(0.2,0.6,0.2),CFrame.new(0,0.9,0.1),CFrame.Angles(0,0,math.rad(27)),false,false,"Brick",true,prt.sheath_1.part) | |
| 265 | CreatePart(prt, "sheath_7", "Pastel Blue", 0, 0,Vector3.new(0.2,2,0.2),CFrame.new(0.2,0,0),CFrame.Angles(0,0,0),false,false,"Brick",true,prt.sheath_1.part) | |
| 266 | CreatePart(prt, "sheath_8", "Pastel Blue", 0, 0,Vector3.new(0.2,2,0.2),CFrame.new(-0.2,0,0),CFrame.Angles(0,0,0),false,false,"Brick",true,prt.sheath_1.part) | |
| 267 | CreatePart(prt, "sheath_9", "Pastel Blue", 0, 0,Vector3.new(0.2,0.72,0.2),CFrame.new(0.09,2.0125,0.13),CFrame.Angles(math.rad(35),0,-math.rad(20)),false,false,"Brick",true,prt.sheath_7.part) | |
| 268 | CreatePart(prt, "sheath_10", "Pastel Blue", 0, 0,Vector3.new(0.2,0.72,0.2),CFrame.new(-0.09,2.0125,0.13),CFrame.Angles(math.rad(35),0,math.rad(20)),false,false,"Brick",true,prt.sheath_8.part) | |
| 269 | CreatePart(prt, "sheath_11", "Pastel Blue", 0, 1,Vector3.new(0.25,0.425,0.25),CFrame.new(0,0.085,0),CFrame.Angles(0,0,0),false,false,"Brick",true,prt.sheath_9.part) | |
| 270 | CreatePart(prt, "sheath_12", "Pastel Blue", 0, 1,Vector3.new(0.25,0.425,0.25),CFrame.new(0,0.085,0),CFrame.Angles(0,0,0),false,false,"Brick",true,prt.sheath_10.part) | |
| 271 | CreatePart(prt, "sheath_13", "Pastel Blue", 0, 1,Vector3.new(0.2,0.7,0.2),CFrame.new(0,0,0),CFrame.Angles(math.rad(-145),0,0),false,false,"Brick",true,prt.sheath_2.part) | |
| 272 | CreatePart(prt, "sheath_14", "Pastel Blue", 0, 1,Vector3.new(0.2,1.11,0.2),CFrame.new(0.072,-0.025,0.1),CFrame.Angles(0,0,0),false,false,"Brick",true,prt.sheath_1.part) | |
| 273 | CreatePart(prt, "gunsheath_1", sheathColor, 0, 0, Vector3.new(0.5,0.9,0.7), CFrame.new(1.2,-0.2,0), CFrame.Angles(math.rad(-20),0,0),false, false,"Brick",true,prt.torso_3.part) | |
| 274 | CreatePart(prt, "gunsheath_2", "Pastel Blue", 0, 1, Vector3.new(0.3,0.2,0.3), CFrame.new(0.1,0.2,-0.225), CFrame.Angles(0,0,0),false,false, "Brick",true,prt.gunsheath_1.part) | |
| 275 | CreatePart(prt, "gunsheath_3", "Pastel Blue", 0, 1, Vector3.new(0.3,0.2,0.3), CFrame.new(0,-0.1,0), CFrame.Angles(0,0,0),false,false, "Brick",true,prt.gunsheath_2.part) | |
| 276 | CreatePart(prt, "gunsheath_4", "Pastel Blue", 0, 1, Vector3.new(0.3,0.2,0.3), CFrame.new(0,-0.1,0), CFrame.Angles(0,0,0),false, false,"Brick",true,prt.gunsheath_3.part) | |
| 277 | CreatePart(prt, "gun_1", gunColor, 0, 0, Vector3.new(0.4,0.775,0.5), CFrame.new(0,0.6,0.15), CFrame.Angles(math.rad(-105),0,0),false, false,"Brick",true,prt.gunsheath_1.part) | |
| 278 | CreatePart(prt, "gun_2", gunColor, 0, 0, Vector3.new(0.4,0.5,0.9), CFrame.new(0,0.2,-0.275), CFrame.Angles(math.rad(15),0,0),false, false,"Brick",true,prt.gun_1.part) | |
| 279 | CreatePart(prt, "gun_3", gunColor, 0, 0, Vector3.new(0.4,0.45,0.55), CFrame.new(0,0.1,0.26), CFrame.Angles(0,0,0),false, false,"Brick",true,prt.gun_2.part) | |
| 280 | CreatePart(prt, "gun_4", "Pastel Blue", 0, 1, Vector3.new(0.3,0.4,0.55), CFrame.new(0,0,-0.3), CFrame.Angles(0,0,0),false, false,"Brick",true,prt.gun_3.part) | |
| 281 | CreatePart(prt, "gun_5", gunColor, 0, 0, Vector3.new(0.4,0.45,0.6), CFrame.new(0,0,-0.55), CFrame.Angles(0,0,0),false,false, "Brick",true,prt.gun_3.part) | |
| 282 | CreatePart(prt, "gun_6", gunColor, 0, 0, Vector3.new(0.4,0.45,0.2), CFrame.new(0,0,-0.22), CFrame.Angles(0,0,0),false, false,"Brick",true,prt.gun_3.part) | |
| 283 | CreatePart(prt, "gun_7", gunColor, 0, 0, Vector3.new(0.4,0.45,0.2), CFrame.new(0,0,-0.3), CFrame.Angles(0,0,0),false, false,"Brick",true,prt.gun_3.part) | |
| 284 | CreatePart(prt, "gun_8", gunColor, 0, 0, Vector3.new(0.2,0.2,0.5), CFrame.new(0,-0.25,0.18), CFrame.Angles(0,0,0),false,false, "Brick",true,prt.gun_2.part) | |
| 285 | CreatePart(prt, "gun_9", gunColor, 0, 0, Vector3.new(0.2,0.2,0.5), CFrame.new(0,0.105,-0.105), CFrame.Angles(math.rad(90),0,0),false,false, "Brick",true,prt.gun_8.part) | |
| 286 | CreatePart(prt, "gun_10", gunColor, 0, 0, Vector3.new(0.2,0.2,0.5), CFrame.new(0,0.1725,-0.03), CFrame.Angles(math.rad(90),0,0),false,false, "Brick",true,prt.gun_8.part) | |
| 287 | CreatePart(prt, "gunbullet", "Really black", 0, 0, Vector3.new(0.325,0.2,0.325), CFrame.new(0,0,-0.42), CFrame.Angles(math.rad(90),0,0),false,false, "Cylinder",true,prt.gun_7.part) | |
| 288 | CreatePart(prt, "gunpointer", "Pastel Blue", 0, 0, Vector3.new(0.275,0.2,0.275), CFrame.new(0,-0.065,-0.39), CFrame.Angles(math.rad(90),0,0),false,false, "Cylinder",true,prt.gun_2.part) | |
| 289 | CreatePart(prt, "sword_1", swordHandleColor, 0, 0, Vector3.new(0.4,0.9,0.35), CFrame.new(0,2.715,0), CFrame.Angles(0,0,0),false,false, "Brick",true,prt.sheath_1.part) | |
| 290 | CreatePart(prt, "sword_2", "Really black", 0, 0, Vector3.new(0.5,2.135,0.25), CFrame.new(0,-2.68,0), CFrame.Angles(0,0,0),false,false, "Brick",true,prt.sword_1.part) | |
| 291 | CreatePart(prt, "sword_3", "Really black", 0, 0, Vector3.new(0.25,0.55,0.5), CFrame.new(0,-5.1,0), CFrame.Angles(0,math.rad(90),math.rad(180)),false,false,"Wedge",true,prt.sword_1.part) | |
| 292 | CreatePart(prt, "sword_4", "Really black", 0, 0, Vector3.new(0.9,0.3,0.55), CFrame.new(0,-0.4,0), CFrame.Angles(0,0,0),false, false,"Brick",true,prt.sword_1.part) | |
| 293 | CreatePart(prt, "sword_5", "Really black", 1, 0, Vector3.new(1.8,4.4,0.2), CFrame.new(0.7,0,0), CFrame.Angles(0,0,0),false, false,"Brick",false,prt.sword_2.part) | |
| 294 | CreatePart(prt, "sword_6", "Pastel Blue", 0, 0, Vector3.new(0.2,1.7,0.3), CFrame.new(0,-1.5,0), CFrame.Angles(0,0,0),false,false, "Brick",true,prt.sword_1.part) | |
| 295 | elseif prt.torso_1 ~= nil then prt.torso_1.weld.Part0 = part.ftor end | |
| 296 | suited = true | |
| 297 | processing = false | |
| 298 | return prt | |
| 299 | end -- +7 | |
| 300 | ||
| 301 | function Trail(val) | |
| 302 | if not _prt.sword_1.part then return end | |
| 303 | trail = val | |
| 304 | if trail then | |
| 305 | coroutine.wrap(function() | |
| 306 | local last = _prt.sword_3.part.CFrame.p | |
| 307 | while use and trail and _prt.sword_3.part ~= nil do wait(.02) | |
| 308 | local new = _prt.sword_3.part.CFrame.p | |
| 309 | local mag = (last - new).magnitude | |
| 310 | local pos = CFrame.new(last, new) * CFrame.Angles(math.rad(-90), 0, 0) | |
| 311 | local trl = Instance.new("Part")
| |
| 312 | local msh = Instance.new("CylinderMesh", trl)
| |
| 313 | trl.Name = "NSword_TRAIL" | |
| 314 | trl.Anchored = true | |
| 315 | trl.Locked = true | |
| 316 | trl.CanCollide = false | |
| 317 | trl.FormFactor = Enum.FormFactor.Custom | |
| 318 | trl.BrickColor = BrickColor.new("Really black")
| |
| 319 | trl.Transparency = 0.3 | |
| 320 | trl.Size = Vector3.new(0.2, mag, 0.2) | |
| 321 | msh.Scale = Vector3.new(1.8, 1, 1.8) | |
| 322 | trl.CFrame = pos * CFrame.new(0,mag/2,0) | |
| 323 | trl.Parent = game.Workspace | |
| 324 | coroutine.wrap(function() for i = trl.Transparency, 1, .05 do trl.Transparency = i msh.Scale = msh.Scale - Vector3.new(.15, 0, .15) wait(.02) end pcall(function() trl:Destroy() end) end)() | |
| 325 | last = _prt.sword_3.part.CFrame.p | |
| 326 | end | |
| 327 | end)() | |
| 328 | end | |
| 329 | end | |
| 330 | ||
| 331 | function LightingGen(init,target,ran,delay,size,damage) | |
| 332 | local CL = function() | |
| 333 | local lght = Instance.new("Part")
| |
| 334 | local msh = Instance.new("CylinderMesh", lght)
| |
| 335 | local size = size or .3 | |
| 336 | msh.Scale = Vector3.new(size,1,size) | |
| 337 | lght.Name = "NSword_LIGHT" | |
| 338 | lght.Anchored = true | |
| 339 | lght.Locked = true | |
| 340 | lght.CanCollide = false | |
| 341 | lght.Reflectance = 0 | |
| 342 | lght.FormFactor = Enum.FormFactor.Custom | |
| 343 | lght.BrickColor = BrickColor.new("Really black")
| |
| 344 | lght.Transparency = 0.5 | |
| 345 | lght.Parent = char | |
| 346 | return lght | |
| 347 | end | |
| 348 | local delay, cPos = delay or .03 | |
| 349 | local rand = Vector3.new(math.random(-ran,ran)/10, math.random(-ran,ran)/10, math.random(-ran,ran)/10) | |
| 350 | local mPos = (init - target).magnitude | |
| 351 | local dLgt = math.random(1,5) | |
| 352 | local dLgt = dLgt/10 | |
| 353 | local rVec = init + (target - init) * dLgt | |
| 354 | local dVec = rVec - init | |
| 355 | local gPos = CFrame.new(init, rVec + rand) * CFrame.Angles(math.rad(-90), 0, 0) | |
| 356 | local rMag = (init - rVec + rand).magnitude | |
| 357 | for i = dLgt, 1 - dLgt, dLgt do | |
| 358 | local cPrt = CL() | |
| 359 | cPrt.Size = Vector3.new(.2,rMag,.2) | |
| 360 | cPrt.CFrame = gPos * CFrame.new(0,rMag/2,0) | |
| 361 | cPos = gPos * CFrame.new(0,rMag,0) | |
| 362 | print("TEST")
| |
| 363 | cPrt.Touched:connect(function(targ) print(targ:GetFullName()) | |
| 364 | if targ.Parent:FindFirstChild("Humanoid") or targ.Parent:FindFirstChild("Zombie") then
| |
| 365 | if game.Players:GetPlayerFromCharacter(targ.Parent) ~= player then | |
| 366 | print(targ:GetFullName()) | |
| 367 | local humanoid = targ.Parent.Humanoid or targ.Parent.Zombie | |
| 368 | local dmg = damage or 10 | |
| 369 | humanoid.Health = humanoid.Health - dmg | |
| 370 | end | |
| 371 | end | |
| 372 | end) | |
| 373 | coroutine.wrap(function() wait(delay) pcall(function() cPrt:Destroy() end) end)() | |
| 374 | if i <= 1 - dLgt * 2 then | |
| 375 | rVec = init + (target - init) * (i + dLgt) | |
| 376 | rand = Vector3.new(math.random(-ran,ran)/10, math.random(-ran,ran)/10, math.random(-ran,ran)/10) | |
| 377 | gPos = CFrame.new(cPos.p, rVec + rand) * CFrame.Angles(math.rad(-90), 0, 0) | |
| 378 | rMag = (cPos.p - rVec + rand).magnitude | |
| 379 | end | |
| 380 | end | |
| 381 | gPos = CFrame.new(cPos.p, target) * CFrame.Angles(math.rad(-90), 0, 0) | |
| 382 | rMag = (cPos.p - target).magnitude | |
| 383 | local cPrt = CL() | |
| 384 | cPrt.Size = Vector3.new(.2,rMag,.2) | |
| 385 | cPrt.CFrame = gPos * CFrame.new(0,rMag/2,0) | |
| 386 | cPrt.Touched:connect(function(targ) print(targ:GetFullName()) | |
| 387 | if targ.Parent:FindFirstChild("Humanoid") or targ.Parent:FindFirstChild("Zombie") then
| |
| 388 | if game.Players:GetPlayerFromCharacter(targ.Parent) ~= player then | |
| 389 | print(targ:GetFullName()) | |
| 390 | local humanoid = targ.Parent.Humanoid or targ.Parent.Zombie | |
| 391 | local dmg = damage or 10 | |
| 392 | humanoid.Health = humanoid.Health - dmg | |
| 393 | end | |
| 394 | end | |
| 395 | end) | |
| 396 | coroutine.wrap(function() wait(delay) pcall(function() cPrt:Destroy() end) end)() | |
| 397 | end | |
| 398 | ||
| 399 | function SwordEquip(force) | |
| 400 | if processing and not force then return end | |
| 401 | processing,cfs = true,true | |
| 402 | if suited then | |
| 403 | Bind("rsho")
| |
| 404 | CF(_jnt.rsho, nil, CFrame.Angles(0, 0, math.rad(90)), .05, true) | |
| 405 | CF(_prt.sword_1.weld, CFrame.new(0,4.5,0), nil, .05, true) | |
| 406 | for i = 0, 1, .05 do | |
| 407 | _prt.sword_1.part.Transparency = i | |
| 408 | _prt.sword_2.part.Transparency = i | |
| 409 | _prt.sword_3.part.Transparency = i | |
| 410 | _prt.sword_4.part.Transparency = i | |
| 411 | _prt.sword_6.part.Transparency = i | |
| 412 | wait(.015) | |
| 413 | end | |
| 414 | _prt.sword_1.part.Transparency = 1 | |
| 415 | _prt.sword_2.part.Transparency = 1 | |
| 416 | _prt.sword_3.part.Transparency = 1 | |
| 417 | _prt.sword_4.part.Transparency = 1 | |
| 418 | _prt.sword_6.part.Transparency = 1 | |
| 419 | _prt.sword_1.weld.Part0 = part.rarm | |
| 420 | CF(_prt.sword_1.weld, CFrame.new(0, -1, -0.25), CFrame.Angles(0, math.rad(90), 0)) | |
| 421 | for i = 0, 1, .05 do | |
| 422 | _prt.sword_1.part.Transparency = 1 - i | |
| 423 | _prt.sword_2.part.Transparency = 1 - i | |
| 424 | _prt.sword_3.part.Transparency = 1 - i | |
| 425 | _prt.sword_4.part.Transparency = 1 - i | |
| 426 | _prt.sword_6.part.Transparency = 1 - i | |
| 427 | wait(.015) | |
| 428 | end | |
| 429 | _prt.sword_1.part.Transparency = 0 | |
| 430 | _prt.sword_2.part.Transparency = 0 | |
| 431 | _prt.sword_3.part.Transparency = 0 | |
| 432 | _prt.sword_4.part.Transparency = 0 | |
| 433 | Bind("lsho")
| |
| 434 | huma.WalkSpeed = 30 | |
| 435 | CF(_jnt.lsho, nil, CFrame.Angles(0, 0, math.rad(-5)), .07, true) | |
| 436 | CF(_prt.sword_1.weld, nil, CFrame.Angles(math.rad(90), math.rad(90), 0), .07, true) | |
| 437 | CF(_jnt.rsho, nil, CFrame.Angles(0, 0, math.rad(5)), .07) | |
| 438 | end | |
| 439 | mode,processing,cfs = 1, false, false | |
| 440 | Walk() | |
| 441 | end | |
| 442 | ||
| 443 | function SwordUnequip(force) | |
| 444 | if processing and not force then return end | |
| 445 | processing,cfs = true,true | |
| 446 | if suited then | |
| 447 | CF(_jnt.neck, nil, CFrame.Angles(0, 0, 0), .2, true) | |
| 448 | CF(_jnt.tors, nil, CFrame.Angles(0, 0, 0), .2, true) | |
| 449 | CF(_jnt.lsho, CFrame.new(-1.5,0.5,0), CFrame.Angles(0, 0, math.rad(-5)), .2, true) | |
| 450 | CF(_jnt.rsho, nil, CFrame.Angles(math.rad(100), math.rad(90), 0), .07) | |
| 451 | Trail(true) | |
| 452 | CF(_prt.sword_1.weld, nil, CFrame.Angles(0, math.rad(90), 0), .15, true) | |
| 453 | CF(_jnt.rsho, nil, CFrame.Angles(0, 0, math.rad(90)), .15) | |
| 454 | Trail(false) | |
| 455 | for i = 0, 1, .05 do | |
| 456 | _prt.sword_1.part.Transparency = i | |
| 457 | _prt.sword_2.part.Transparency = i | |
| 458 | _prt.sword_3.part.Transparency = i | |
| 459 | _prt.sword_4.part.Transparency = i | |
| 460 | _prt.sword_6.part.Transparency = i | |
| 461 | wait(.015) | |
| 462 | end | |
| 463 | _prt.sword_1.part.Transparency = 1 | |
| 464 | _prt.sword_2.part.Transparency = 1 | |
| 465 | _prt.sword_3.part.Transparency = 1 | |
| 466 | _prt.sword_4.part.Transparency = 1 | |
| 467 | _prt.sword_6.part.Transparency = 1 | |
| 468 | _prt.sword_1.weld.Part0 = _prt.sheath_1.part | |
| 469 | CF(_prt.sword_1.weld, CFrame.new(0, 4.5, 0), CFrame.Angles(0, 0, 0)) | |
| 470 | CF(_prt.sword_1.weld, CFrame.new(0,2.715,0), CFrame.Angles(0, 0, 0), .05, true) | |
| 471 | for i = 0, 1, .05 do | |
| 472 | _prt.sword_1.part.Transparency = 1 - i | |
| 473 | _prt.sword_2.part.Transparency = 1 - i | |
| 474 | _prt.sword_3.part.Transparency = 1 - i | |
| 475 | _prt.sword_4.part.Transparency = 1 - i | |
| 476 | _prt.sword_6.part.Transparency = 1 - i | |
| 477 | wait(.015) | |
| 478 | end | |
| 479 | _prt.sword_1.part.Transparency = 0 | |
| 480 | _prt.sword_2.part.Transparency = 0 | |
| 481 | _prt.sword_3.part.Transparency = 0 | |
| 482 | _prt.sword_4.part.Transparency = 0 | |
| 483 | huma.WalkSpeed = defaultWalkspeed | |
| 484 | CF(_jnt.lsho, nil, CFrame.Angles(0, 0, 0), .07, true) | |
| 485 | CF(_jnt.rsho, nil, CFrame.Angles(0, 0, 0), .07) | |
| 486 | Release("rsho")
| |
| 487 | Release("lsho")
| |
| 488 | end | |
| 489 | mode,processing,cfs = 0, false, false | |
| 490 | end | |
| 491 | ||
| 492 | function GunEquip(force) | |
| 493 | if processing and not force then return end | |
| 494 | processing,cfs = true,true | |
| 495 | if suited then | |
| 496 | Bind("rsho")
| |
| 497 | CF(_jnt.rsho, CFrame.new(1.5,0.9,0), CFrame.Angles(math.rad(-20), 0, 0), 0.15) | |
| 498 | gunTakePos = _prt.gun_1.part.CFrame:inverse() * part.rarm.CFrame | |
| 499 | _prt.gun_1.weld.Part0 = part.rarm | |
| 500 | _prt.gun_1.weld.C0 = gunTakePos:inverse() | |
| 501 | CF(_jnt.rsho, CFrame.new(1.5,1.7,0), CFrame.Angles(math.rad(-20), 0, math.rad(2)), 0.15) | |
| 502 | Bind("lsho")
| |
| 503 | CF(_jnt.lsho, nil, CFrame.Angles(math.rad(-5), 0, math.rad(-5)), 0.08, true) | |
| 504 | CF(_jnt.rsho, CFrame.new(1.5,0.5,0), CFrame.Angles(math.rad(-10), 0, math.rad(10)), 0.08, true) | |
| 505 | CF(_prt.gun_1.weld, _prt.gun_1.weld.C0 * CFrame.new(0.25,-0.1,0.1), nil, 0.08) | |
| 506 | end | |
| 507 | mode,processing,cfs = 2, false, false | |
| 508 | Walk() | |
| 509 | end | |
| 510 | ||
| 511 | function GunUnequip(force) | |
| 512 | if processing and not force then return end | |
| 513 | processing = true | |
| 514 | if suited then | |
| 515 | if not gs and gtarget then gtarget = false repeat wait(.015) until gs end | |
| 516 | CF(_jnt.neck, nil, CFrame.Angles(0, 0, 0), .2, true) | |
| 517 | CF(_jnt.tors, nil, CFrame.Angles(0, 0, 0), .2, true) | |
| 518 | CF(_jnt.lsho, CFrame.new(-1.5,0.5,0), CFrame.Angles(0, 0, math.rad(-5)), .2, true) | |
| 519 | CF(_prt.gun_1.weld, gunTakePos:inverse(), (gunTakePos - gunTakePos.p):inverse(), 0.15, true) | |
| 520 | CF(_jnt.rsho, CFrame.new(1.5,1.7,0), CFrame.Angles(math.rad(-20), 0, math.rad(2)), 0.15) | |
| 521 | CF(_jnt.rsho, CFrame.new(1.5,0.9,0), CFrame.Angles(math.rad(-20), 0, 0), 0.15) | |
| 522 | _prt.gun_1.weld.Part0 = _prt.gunsheath_1.part | |
| 523 | CF(_prt.gun_1.weld, CFrame.new(0,0.6,0.15), CFrame.Angles(math.rad(-105),0,0)) | |
| 524 | CF(_jnt.rsho, CFrame.new(1.5,0.5,0), CFrame.Angles(0, 0, 0), 0.08) | |
| 525 | Release("rsho")
| |
| 526 | Release("lsho")
| |
| 527 | end | |
| 528 | mode,processing,cfs = 0, false, false | |
| 529 | end | |
| 530 | ||
| 531 | function LightEquip(force) | |
| 532 | if processing and not force then return end | |
| 533 | processing,cfs = true,true | |
| 534 | if suited then | |
| 535 | Bind("rsho")
| |
| 536 | Bind("lsho")
| |
| 537 | huma.WalkSpeed = 30 | |
| 538 | CF(_jnt.lsho, nil, CFrame.Angles(0, 0, math.rad(-5)), .07, true) | |
| 539 | CF(_jnt.rsho, nil, CFrame.Angles(0, 0, math.rad(5)), .07) | |
| 540 | end | |
| 541 | mode,processing,cfs = 3, false, false | |
| 542 | Walk() | |
| 543 | end | |
| 544 | ||
| 545 | function LightUnequip(force) | |
| 546 | if processing and not force then return end | |
| 547 | processing,cfs = true,true | |
| 548 | if suited then | |
| 549 | huma.WalkSpeed = defaultWalkspeed | |
| 550 | CF(_jnt.neck, nil, CFrame.Angles(0, 0, 0), .2, true) | |
| 551 | CF(_jnt.tors, nil, CFrame.Angles(0, 0, 0), .2, true) | |
| 552 | CF(_jnt.lsho, nil, CFrame.Angles(0, 0, 0), .07, true) | |
| 553 | CF(_jnt.rsho, nil, CFrame.Angles(0, 0, 0), .07) | |
| 554 | Release("rsho")
| |
| 555 | Release("lsho")
| |
| 556 | end | |
| 557 | mode,processing,cfs = 0, false, false | |
| 558 | Walk() | |
| 559 | end | |
| 560 | ||
| 561 | function Walk() | |
| 562 | if use then | |
| 563 | while processing or animate do wait(.015) end | |
| 564 | if w or a or s or d then | |
| 565 | animate = true | |
| 566 | if mode == 1 then | |
| 567 | CF(_jnt.neck, nil, CFrame.Angles(0, math.rad(65), 0), .15, true, true) | |
| 568 | CF(_jnt.tors, nil, CFrame.Angles(0, math.rad(-65), 0), .15, true, true) | |
| 569 | CF(_jnt.rsho, nil, CFrame.Angles(math.rad(-20), 0, math.rad(70)), .15, true, true) | |
| 570 | CF(_jnt.lsho, nil, CFrame.Angles(math.rad(30), math.rad(20), math.rad(5)), .15, false, true) | |
| 571 | elseif mode == 2 then | |
| 572 | CF(_jnt.neck, nil, CFrame.Angles(0, math.rad(65), 0), .15, true, true) | |
| 573 | CF(_jnt.tors, nil, CFrame.Angles(0, math.rad(-65), 0), .15, true, true) | |
| 574 | CF(_jnt.rsho, CFrame.new(1,0.4,-0.2), CFrame.Angles(math.rad(35), math.rad(20), math.rad(-40)), .15, true, true) | |
| 575 | CF(_jnt.lsho, CFrame.new(-1,0.5,0), CFrame.Angles(math.rad(60), math.rad(-20), math.rad(35)), .15, false, true) | |
| 576 | elseif mode == 3 then | |
| 577 | CF(_jnt.rsho, nil, CFrame.Angles(math.rad(-35), 0, math.rad(10)), .15, true, true) | |
| 578 | CF(_jnt.lsho, nil, CFrame.Angles(math.rad(-35), 0, math.rad(-10)), .15, false, true) | |
| 579 | end | |
| 580 | animate = false | |
| 581 | end | |
| 582 | end | |
| 583 | end | |
| 584 | ||
| 585 | function Stand() | |
| 586 | if use then | |
| 587 | while processing or animate do wait(.015) end | |
| 588 | if not w and not a and not s and not d and not jumping then | |
| 589 | animate = true | |
| 590 | if mode ~= 0 then | |
| 591 | CF(_jnt.neck, CFrame.new(0,1,0), CFrame.Angles(0, 0, 0), .2, true, true) | |
| 592 | CF(_jnt.tors, CFrame.new(0,0,0), CFrame.Angles(0, 0, 0), .2, true, true) | |
| 593 | CF(_jnt.rsho, CFrame.new(1.5,0.5,0), CFrame.Angles(0, 0, math.rad(5)), .2, true, true) | |
| 594 | CF(_jnt.lsho, CFrame.new(-1.5,0.5,0), CFrame.Angles(0, 0, math.rad(-5)), .2, false, true) | |
| 595 | end | |
| 596 | animate = false | |
| 597 | end | |
| 598 | end | |
| 599 | end | |
| 600 | ||
| 601 | function FAC(num,res) | |
| 602 | if (math.floor(num) <= res + tol and math.floor(num) >= res - tol) or (math.ceil(num) <= res + tol and math.ceil(num) >= res - tol) then return true | |
| 603 | else return false end | |
| 604 | end | |
| 605 | ||
| 606 | function SliceAndKill(p) | |
| 607 | coroutine.wrap(function() | |
| 608 | if p.Name ~= "__NSCUTPART" and p.Name ~= "Base" and p.Name ~= "NSword_TRAIL" and p.Name ~= "NSword_LIGHT" then | |
| 609 | if p.Parent ~= char and p.Parent ~= _mdl and not p.Parent:IsA("Hat") then
| |
| 610 | local pX,pY,pZ = p.CFrame:toEulerAnglesXYZ() | |
| 611 | if (FAC(pX,0) or FAC(pX,180)) and (FAC(pZ,0) or FAC(pZ,180)) and p.Size.y < 0.4 then return end | |
| 612 | pX = math.deg(pX) if pX < 0 then pX = pX * (-1) else pX = math.floor(pX) end | |
| 613 | pZ = math.deg(pZ) if pZ < 0 then pZ = pZ * (-1) else pZ = math.floor(pZ) end | |
| 614 | if not FAC(pX,0) and not FAC(pX,90) and not FAC(pX,180) then return end | |
| 615 | if not FAC(pZ,0) and not FAC(pZ,90) and not FAC(pZ,180) then return end | |
| 616 | if (not FAC(pX,0) and not FAC(pZ,0)) or (not FAC(pX,180) and not FAC(pZ,180)) then | |
| 617 | if FAC(pX,0) and FAC(pZ,180) then | |
| 618 | p.CFrame = p.CFrame * CFrame.Angles(0, 0, math.pi) | |
| 619 | elseif FAC(pX,180) and FAC(pZ,0) then | |
| 620 | p.CFrame = p.CFrame * CFrame.Angles(math.pi, 0, 0) | |
| 621 | elseif FAC(pX,90) and (FAC(pZ,0) or FAC(pZ,180)) then | |
| 622 | local rPart = p:Clone() | |
| 623 | rPart.Anchored = true | |
| 624 | rPart.Size = Vector3.new(p.Size.z,p.Size.x,p.Size.y) | |
| 625 | rPart.CFrame = CFrame.new(p.CFrame.x, p.CFrame.y, p.CFrame.z) * CFrame.Angles(0, pY, 0) | |
| 626 | if not p.Anchored then rPart.Anchored = false end | |
| 627 | rPart.Parent = p.Parent | |
| 628 | p:Remove() | |
| 629 | p = rPart | |
| 630 | elseif FAC(pX,90) and FAC(pZ,90) then | |
| 631 | local rPart = p:Clone() | |
| 632 | rPart.Anchored = true | |
| 633 | rPart.Size = Vector3.new(p.Size.y,p.Size.z,p.Size.x) | |
| 634 | rPart.CFrame = CFrame.new(p.CFrame.x, p.CFrame.y, p.CFrame.z) * CFrame.Angles(0, pY, 0) | |
| 635 | if not p.Anchored then rPart.Anchored = false end | |
| 636 | rPart.Parent = p.Parent | |
| 637 | p:Remove() | |
| 638 | p = rPart | |
| 639 | elseif (FAC(pX,0) or FAC(pX,180)) and FAC(pZ,90) then | |
| 640 | local rPart = p:Clone() | |
| 641 | rPart.Anchored = true | |
| 642 | rPart.Size = Vector3.new(p.Size.y,p.Size.x,p.Size.z) | |
| 643 | rPart.CFrame = CFrame.new(p.CFrame.x, p.CFrame.y, p.CFrame.z) * CFrame.Angles(0, pY, 0) | |
| 644 | if not p.Anchored then rPart.Anchored = false end | |
| 645 | rPart.Parent = p.Parent | |
| 646 | p:Remove() | |
| 647 | p = rPart | |
| 648 | end | |
| 649 | end | |
| 650 | local s = _prt.sword_3.part | |
| 651 | local pYPos = p.CFrame.p.y - (p.Size.y/2) | |
| 652 | local sYPos = s.CFrame.p.y | |
| 653 | if sYPos <= pYPos or sYPos >= (pYPos + p.Size.y) then return end | |
| 654 | local x, y, z = p.CFrame:toEulerAnglesXYZ() | |
| 655 | local c1 = p:Clone() | |
| 656 | local c2 = p:Clone() | |
| 657 | local CC,TR = p.CanCollide, p.Transparency | |
| 658 | local mat = p.Material | |
| 659 | c1:BreakJoints() | |
| 660 | c2:BreakJoints() | |
| 661 | if CC then | |
| 662 | c1.CanCollide = true | |
| 663 | c2.CanCollide = true | |
| 664 | c1.Anchored = false | |
| 665 | c2.Anchored = false | |
| 666 | else | |
| 667 | c1.CanCollide = false | |
| 668 | c2.CanCollide = false | |
| 669 | c1.Anchored = true | |
| 670 | c2.Anchored = true | |
| 671 | end | |
| 672 | c1.FormFactor = Enum.FormFactor.Custom | |
| 673 | c2.FormFactor = Enum.FormFactor.Custom | |
| 674 | c1.Material = Enum.Material.Plastic | |
| 675 | c2.Material = Enum.Material.Plastic | |
| 676 | c1.Size = Vector3.new(p.Size.x,sYPos-pYPos,p.Size.z) | |
| 677 | c2.Size = Vector3.new(p.Size.x,c2.Size.y-(sYPos-pYPos),p.Size.z) | |
| 678 | c1.CFrame = p.CFrame * CFrame.new(0, -c2.Size.y/2,0) | |
| 679 | c2.CFrame = p.CFrame * CFrame.new(0, c1.Size.y/2,0) | |
| 680 | c1.Name = "__NSCUTPART" | |
| 681 | c2.Name = "__NSCUTPART" | |
| 682 | c1.Reflectance = 0.5 | |
| 683 | c2.Reflectance = 0.5 | |
| 684 | c1.Parent = game.Workspace | |
| 685 | c2.Parent = game.Workspace | |
| 686 | p:Remove() | |
| 687 | for i = 1, 10, 1 do wait(0.02) | |
| 688 | c1.Reflectance = c1.Reflectance - 1/10 | |
| 689 | c2.Reflectance = c2.Reflectance - 1/10 | |
| 690 | end | |
| 691 | if not CC then | |
| 692 | coroutine.wrap(function() | |
| 693 | for i = TR, 1, 0.05 do wait(0.02) | |
| 694 | c1.Transparency = i | |
| 695 | c2.Transparency = i | |
| 696 | end pcall(function() c1:Remove() c2:Remove() end) | |
| 697 | end)() | |
| 698 | end | |
| 699 | c1.Reflectance = 0 | |
| 700 | c2.Reflectance = 0 | |
| 701 | c1.Material = mat | |
| 702 | c2.Material = mat | |
| 703 | if CC then | |
| 704 | c1.Name = "_NSCUTPART" | |
| 705 | c2.Name = "_NSCUTPART" | |
| 706 | end | |
| 707 | end | |
| 708 | end | |
| 709 | end)() | |
| 710 | end | |
| 711 | ||
| 712 | function Hit(val) | |
| 713 | hit = val | |
| 714 | if hit then | |
| 715 | coroutine.wrap(function() | |
| 716 | local event = _prt.sword_5.part.Touched:connect(SliceAndKill) | |
| 717 | while use and hit and _prt.sword_2 ~= nil and _prt.sword_3 ~= nil and _prt.sword_5 ~= nil do wait() end | |
| 718 | event:disconnect() | |
| 719 | end)() | |
| 720 | end | |
| 721 | end | |
| 722 | ||
| 723 | function GunTarget() | |
| 724 | if not ms then return end | |
| 725 | if processing and not gtarget then return end | |
| 726 | processing,cfs,gs = true, true, false | |
| 727 | if not gtarget then gtarget = true | |
| 728 | huma.WalkSpeed = 5 | |
| 729 | CF(_jnt.neck, nil, CFrame.Angles(0, math.rad(-90), 0), .1, true) | |
| 730 | CF(_jnt.tors, nil, CFrame.Angles(0, math.rad(90), 0), .1, true) | |
| 731 | CF(_jnt.lsho, CFrame.new(-1.5,0.5,0), CFrame.Angles(math.rad(-5), 0, math.rad(-5)), .1, true) | |
| 732 | CF(_jnt.rsho, CFrame.new(1.5,0.5,0), CFrame.Angles(0, 0, math.rad(90)), .1, true) | |
| 733 | pcall(function() bGyro.Parent = part.tors end) | |
| 734 | repeat wait(.015) | |
| 735 | if ms and not disconnectRequest then | |
| 736 | bGyro.cframe = CFrame.new(part.tors.CFrame.p, Vector3.new(ms.Hit.p.X, part.tors.CFrame.p.Y, ms.Hit.p.Z)) | |
| 737 | _jnt.rsho.C0 = CFrame.new(Vector3.new(1.5,0.5,0), ms.Hit.p) * CFrame.Angles(0, 0, math.rad(90)) | |
| 738 | end | |
| 739 | until not gtarget or not ms gtarget = false | |
| 740 | huma.WalkSpeed = defaultWalkspeed | |
| 741 | pcall(function() bGyro.Parent = nil end) | |
| 742 | CF(_jnt.neck, nil, CFrame.Angles(0, 0, 0), .1, true) | |
| 743 | CF(_jnt.tors, nil, CFrame.Angles(0, 0, 0), .1, true) | |
| 744 | CF(_jnt.lsho, CFrame.new(-1.5,0.5,0), CFrame.Angles(0, 0, math.rad(-5)), .1, true) | |
| 745 | CF(_jnt.rsho, CFrame.new(1.5,0.5,0), CFrame.Angles(0, 0, math.rad(5)), .1) | |
| 746 | end | |
| 747 | processing,cfs,gs = false, false, true | |
| 748 | if not gtarget and not disconnectRequest then Walk() end | |
| 749 | end | |
| 750 | ||
| 751 | function OnKeyDown(key) key = key:lower() | |
| 752 | if bindKeyDown then | |
| 753 | if key == "w" then w = true Walk() end | |
| 754 | if key == "a" then a = true Walk() end | |
| 755 | if key == "s" then s = true Walk() end | |
| 756 | if key == "d" then d = true Walk() end | |
| 757 | if key == "c" then if mode == 0 then SwordEquip() elseif mode == 1 then SwordUnequip() elseif mode == 2 then GunUnequip() SwordEquip() elseif mode == 3 then LightUnequip() SwordEquip() end end | |
| 758 | if key == "v" then if mode == 0 then GunEquip() elseif mode == 2 then GunUnequip() elseif mode == 1 then SwordUnequip() GunEquip() elseif mode == 3 then LightUnequip() GunEquip() end end | |
| 759 | if key == "x" then if mode == 0 then LightEquip() elseif mode == 3 then LightUnequip() elseif mode == 1 then SwordUnequip() LightEquip() elseif mode == 2 then GunUnequip() LightEquip() end end | |
| 760 | if key == "e" then if mode == 2 and not gtarget then GunTarget() else gtarget = false end end | |
| 761 | end | |
| 762 | end | |
| 763 | ||
| 764 | function OnKeyUp(key) key = key:lower() | |
| 765 | if bindKeyUp then | |
| 766 | if key == "w" then w = false if not a and not s and not d then Stand() end end | |
| 767 | if key == "a" then a = false if not w and not s and not d then Stand() end end | |
| 768 | if key == "s" then s = false if not w and not a and not d then Stand() end end | |
| 769 | if key == "d" then d = false if not w and not a and not s then Stand() end end | |
| 770 | end | |
| 771 | end | |
| 772 | ||
| 773 | function OnButton1Down() buttonDown = true combo = combo + 1 | |
| 774 | if not ms then end | |
| 775 | if processing and not gtarget then return end | |
| 776 | processing,cfs = true, true | |
| 777 | if mode == 1 then | |
| 778 | CF(_jnt.neck, nil, CFrame.Angles(0, math.rad(40), 0), .2, true) | |
| 779 | CF(_jnt.tors, nil, CFrame.Angles(0, math.rad(-40), 0), .2, true) | |
| 780 | CF(_prt.sword_1.weld, nil, CFrame.Angles(0, math.rad(-90), 0), .2, true) | |
| 781 | CF(_jnt.lsho, nil, CFrame.Angles(0, 0, math.rad(-10)), .2, true) | |
| 782 | CF(_jnt.rsho, nil, CFrame.Angles(0, math.rad(-20), math.rad(90)), .2) | |
| 783 | pcall(function() bPos.position = Vector3.new(0,part.tors.CFrame.p.Y,0) bPos.Parent = part.tors end) | |
| 784 | Trail(true) | |
| 785 | Hit(true) | |
| 786 | CF(_jnt.neck, nil, CFrame.Angles(0, math.rad(-50), 0), .15, true) | |
| 787 | CF(_jnt.tors, nil, CFrame.Angles(0, math.rad(50), 0), .15, true) | |
| 788 | CF(_prt.sword_1.weld, nil, CFrame.Angles(math.rad(55), math.rad(-90), 0), .15, true) | |
| 789 | CF(_jnt.rsho, nil, CFrame.Angles(math.rad(90), math.rad(90), 0), .15) | |
| 790 | Trail(false) | |
| 791 | Hit(false) | |
| 792 | if combo > 1 then combo = 2 | |
| 793 | if buttonDown then pcall(function() bPos.Parent = nil end) repeat wait(0.015) LightingGen(_prt.sword_4.part.CFrame.p,_prt.sword_3.part.CFrame.p,3,.05) until not buttonDown end | |
| 794 | CF(_prt.sword_1.weld, nil, CFrame.Angles(math.rad(55), math.rad(90),0), .3) | |
| 795 | Trail(true) | |
| 796 | Hit(true) | |
| 797 | CF(_prt.sword_1.weld, nil, CFrame.Angles(0, math.rad(90), 0), .15, true) | |
| 798 | CF(_jnt.neck, nil, CFrame.Angles(0, math.rad(40), 0), .12, true) | |
| 799 | CF(_jnt.tors, nil, CFrame.Angles(0, math.rad(-40), 0), .15, true) | |
| 800 | CF(_jnt.rsho, nil, CFrame.Angles(0, math.rad(-20), math.rad(90)), .15) | |
| 801 | pcall(function() bPos.Parent = nil end) | |
| 802 | Trail(false) | |
| 803 | Hit(false) | |
| 804 | CF(_prt.sword_1.weld, nil, CFrame.Angles(math.rad(90), math.rad(90), 0), .15, true) | |
| 805 | CF(_jnt.neck, nil, CFrame.Angles(0, 0, 0), .15, true) | |
| 806 | CF(_jnt.tors, nil, CFrame.Angles(0, 0, 0), .15, true) | |
| 807 | CF(_jnt.rsho, nil, CFrame.Angles(math.rad(-10), 0, 0), .15) | |
| 808 | else | |
| 809 | pcall(function() bPos.Parent = nil end) | |
| 810 | CF(_prt.sword_1.weld, nil, CFrame.Angles(math.rad(90), math.rad(90), 0), .15, true) | |
| 811 | CF(_jnt.neck, nil, CFrame.Angles(0, 0, 0), .15, true) | |
| 812 | CF(_jnt.tors, nil, CFrame.Angles(0, 0, 0), .15, true) | |
| 813 | CF(_jnt.rsho, nil, CFrame.Angles(0, 0, math.rad(5)), .15) | |
| 814 | end | |
| 815 | elseif mode == 2 then | |
| 816 | ||
| 817 | --> GUN <-- | |
| 818 | ||
| 819 | elseif mode == 3 then | |
| 820 | CF(_jnt.neck, nil, CFrame.Angles(0, math.rad(90), 0), .1, true) | |
| 821 | CF(_jnt.tors, nil, CFrame.Angles(0, math.rad(-90), 0), .1, true) | |
| 822 | CF(_jnt.rsho, nil, CFrame.Angles(math.rad(-20), 0, math.rad(20)), .1, true) | |
| 823 | CF(_jnt.lsho, nil, CFrame.Angles(0, 0, math.rad(-90)), .1) | |
| 824 | while ms and buttonDown and not disconnectRequest do wait(.015) | |
| 825 | pcall(function() bGyro.Parent = part.tors end) | |
| 826 | if ms and not disconnectRequest and huma.Health ~= 0 then | |
| 827 | bGyro.cframe = CFrame.new(part.tors.CFrame.p, Vector3.new(ms.Hit.p.X, part.tors.CFrame.p.Y, ms.Hit.p.Z)) | |
| 828 | if ms.Target then | |
| 829 | LightingGen((part.larm.CFrame * CFrame.new(0,-1,0)).p, ms.Hit.p, 10, .05, .5) | |
| 830 | end | |
| 831 | end | |
| 832 | end | |
| 833 | pcall(function() bGyro.Parent = nil end) | |
| 834 | CF(_jnt.neck, nil, CFrame.Angles(0, 0, 0), .1, true) | |
| 835 | CF(_jnt.tors, nil, CFrame.Angles(0, 0, 0), .1, true) | |
| 836 | CF(_jnt.lsho, nil, CFrame.Angles(0, 0, math.rad(-5)), .1, true) | |
| 837 | CF(_jnt.rsho, nil, CFrame.Angles(0, 0, math.rad(5)), .1) | |
| 838 | end | |
| 839 | combo = 0 | |
| 840 | if not gtarget then processing, cfs = false, false end | |
| 841 | Walk() | |
| 842 | end | |
| 843 | ||
| 844 | function Disconnection() disconnectRequest = true ms = nil | |
| 845 | while processing do wait(.015) end | |
| 846 | w,a,s,d = false,false,false,false | |
| 847 | processing = true | |
| 848 | if use then | |
| 849 | Hit(false) | |
| 850 | bindKeyUp, bindKeyDown = false, false | |
| 851 | if mode == 1 then SwordUnequip(true) end | |
| 852 | if mode == 2 then GunUnequip(true) end | |
| 853 | if mode == 3 then LightUnequip(true) end | |
| 854 | use = false | |
| 855 | huma.WalkSpeed = defaultWalkspeed | |
| 856 | gunTakePos = nil | |
| 857 | w,a,s,d = false,false,false,false | |
| 858 | w2,a2,s2,d2 = false,false,false,false | |
| 859 | _prt.torso_1.weld.Part0 = part.tors | |
| 860 | if delete then part.tors.Transparency = 0 end | |
| 861 | for i,mtor in pairs (motor) do | |
| 862 | pcall(function() mtor.Part0 = part.tors end) | |
| 863 | end | |
| 864 | if _jnt ~= nil then | |
| 865 | for i,weld in pairs(_jnt) do | |
| 866 | pcall(function() weld:Remove() end) | |
| 867 | end | |
| 868 | end | |
| 869 | if part.ftor ~= nil then part.ftor:Remove() end | |
| 870 | if delete then | |
| 871 | if shirt ~= nil then shirt.Parent = char end | |
| 872 | if _mdl ~= nil then _mdl:Remove() end | |
| 873 | suited = false | |
| 874 | model = false | |
| 875 | prt = {}
| |
| 876 | end | |
| 877 | _jnt,_mdl,_prt = nil, nil, nil | |
| 878 | _kup:disconnect() | |
| 879 | _kdn:disconnect() | |
| 880 | _mse:disconnect() | |
| 881 | _ms2:disconnect() | |
| 882 | combo = 0 | |
| 883 | _kup,_kdn,_mse,_ms2 = nil,nil,nil,nil | |
| 884 | initialized = false | |
| 885 | end | |
| 886 | disconnectRequest = false | |
| 887 | processing = false | |
| 888 | end | |
| 889 | ||
| 890 | function _Main(mouse) | |
| 891 | while processing do wait(0.015) end | |
| 892 | ms = mouse | |
| 893 | _jnt = JoinInit() | |
| 894 | _mdl = SuitInit() | |
| 895 | _prt = LoadSuit() | |
| 896 | mode = 0 | |
| 897 | _kup = mouse.KeyUp:connect(OnKeyUp) | |
| 898 | _kdn = mouse.KeyDown:connect(OnKeyDown) | |
| 899 | _mse = mouse.Button1Down:connect(OnButton1Down) | |
| 900 | _ms2 = mouse.Button1Up:connect(function() buttonDown = false end) | |
| 901 | use, bindKeyUp, bindKeyDown = true, true, true | |
| 902 | end | |
| 903 | ||
| 904 | bin.Selected:connect(_Main) | |
| 905 | bin.Deselected:connect(Disconnection) |