Advertisement
waconline

Nsword

Oct 27th, 2019
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 57.55 KB | None | 0 0
  1.  
  2. --https://github.com/Mokiros/roblox-FE-compatibility
  3. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  4. local Player,game,owner = owner,game
  5. local RealPlayer = Player
  6. do
  7. print("FE Compatibility code V2 by Mokiros")
  8. local RealPlayer = RealPlayer
  9. script.Parent = RealPlayer.Character
  10.  
  11. --Fake event to make stuff like Mouse.KeyDown work
  12. local Disconnect_Function = function(this)
  13. this[1].Functions[this[2]] = nil
  14. end
  15. local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
  16. local FakeEvent_Metatable = {__index={
  17. Connect = function(this,f)
  18. local i = tostring(math.random(0,10000))
  19. while this.Functions[i] do
  20. i = tostring(math.random(0,10000))
  21. end
  22. this.Functions[i] = f
  23. return setmetatable({this,i},Disconnect_Metatable)
  24. end
  25. }}
  26. FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
  27. local function fakeEvent()
  28. return setmetatable({Functions={}},FakeEvent_Metatable)
  29. end
  30.  
  31. --Creating fake input objects with fake variables
  32. local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  33. FakeMouse.keyUp = FakeMouse.KeyUp
  34. FakeMouse.keyDown = FakeMouse.KeyDown
  35. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  36. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  37. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  38. end}
  39. --Merged 2 functions into one by checking amount of arguments
  40. CAS.UnbindAction = CAS.BindAction
  41.  
  42. --This function will trigger the events that have been :Connect()'ed
  43. local function TriggerEvent(self,ev,...)
  44. for _,f in pairs(self[ev].Functions) do
  45. f(...)
  46. end
  47. end
  48. FakeMouse.TriggerEvent = TriggerEvent
  49. UIS.TriggerEvent = TriggerEvent
  50.  
  51. --Client communication
  52. local Event = Instance.new("RemoteEvent")
  53. Event.Name = "UserInput_Event"
  54. Event.OnServerEvent:Connect(function(plr,io)
  55. if plr~=RealPlayer then return end
  56. FakeMouse.Target = io.Target
  57. FakeMouse.Hit = io.Hit
  58. if not io.isMouse then
  59. local b = io.UserInputState == Enum.UserInputState.Begin
  60. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  61. return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
  62. end
  63. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  64. return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
  65. end
  66. for _,t in pairs(CAS.Actions) do
  67. for _,k in pairs(t.Keys) do
  68. if k==io.KeyCode then
  69. t.Function(t.Name,io.UserInputState,io)
  70. end
  71. end
  72. end
  73. FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  74. UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
  75. end
  76. end)
  77. Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
  78. local Mouse = owner:GetMouse()
  79. local UIS = game:GetService("UserInputService")
  80. local input = function(io,RobloxHandled)
  81. if RobloxHandled then return end
  82. --Since InputObject is a client-side instance, we create and pass table instead
  83. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  84. end
  85. UIS.InputBegan:Connect(input)
  86. UIS.InputEnded:Connect(input)
  87.  
  88. local h,t
  89. --Give the server mouse data every second frame, but only if the values changed
  90. --If player is not moving their mouse, client won't fire events
  91. local HB = game:GetService("RunService").Heartbeat
  92. while true do
  93. if h~=Mouse.Hit or t~=Mouse.Target then
  94. h,t=Mouse.Hit,Mouse.Target
  95. Event:FireServer({isMouse=true,Target=t,Hit=h})
  96. end
  97. --Wait 2 frames
  98. for i=1,2 do
  99. HB:Wait()
  100. end
  101. end]==],script)
  102.  
  103. ----Sandboxed game object that allows the usage of client-side methods and services
  104. --Real game object
  105. local RealGame = game
  106.  
  107. --Metatable for fake service
  108. local FakeService_Metatable = {
  109. __index = function(self,k)
  110. local s = rawget(self,"_RealService")
  111. if s then
  112. return typeof(s[k])=="function"
  113. and function(_,...)return s[k](s,...)end or s[k]
  114. end
  115. end,
  116. __newindex = function(self,k,v)
  117. local s = rawget(self,"_RealService")
  118. if s then s[k]=v end
  119. end
  120. }
  121. local function FakeService(t,RealService)
  122. t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
  123. return setmetatable(t,FakeService_Metatable)
  124. end
  125.  
  126. --Fake game object
  127. local FakeGame = {
  128. GetService = function(self,s)
  129. return rawget(self,s) or RealGame:GetService(s)
  130. end,
  131. Players = FakeService({
  132. LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
  133. },"Players"),
  134. UserInputService = FakeService(UIS,"UserInputService"),
  135. ContextActionService = FakeService(CAS,"ContextActionService"),
  136. RunService = FakeService({
  137. _btrs = {},
  138. RenderStepped = RealGame:GetService("RunService").Heartbeat,
  139. BindToRenderStep = function(self,name,_,fun)
  140. self._btrs[name] = self.Heartbeat:Connect(fun)
  141. end,
  142. UnbindFromRenderStep = function(self,name)
  143. self._btrs[name]:Disconnect()
  144. end,
  145. },"RunService")
  146. }
  147. rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
  148. FakeGame.service = FakeGame.GetService
  149. FakeService(FakeGame,game)
  150. --Changing owner to fake player object to support owner:GetMouse()
  151. game,owner = FakeGame,FakeGame.Players.LocalPlayer
  152. end
  153. local _CODE = "_NSword"
  154.  
  155. --==================================================-VARIABLES-==================================================--
  156.  
  157. local player = owner
  158. local char = player.Character
  159. local huma = char:FindFirstChild("Humanoid")
  160. local initialized, disconnectRequest = false, false
  161. local model,suited,use,processing,animate,gtarget,gs = false,false,false,false,false,false,true
  162. local w,a,s,d = false,false,false,false
  163. local bindKeyDown,bindKeyUp = false,false
  164. local hit,trail,lighting,shirt,bin = false, false, false, false, false
  165. local bPos, bGyro = Instance.new("BodyPosition"), Instance.new("BodyGyro")
  166. local delete = true
  167. local prt,_jnt,_mdl,_prt,_kup,_kdn,_mse,ms = {}
  168. local combo = 0
  169. local tol = 4
  170. local mode = 0
  171. local cfs = false
  172. local jumping = false
  173. local buttonDown = false
  174. local shirtColor = "Really black"
  175. local pantsColor = "Really black"
  176. local attachColor = "Really black"
  177. local sheathColor = "Really black"
  178. local swordHandleColor = "Really black"
  179. local gunColor = "Really black"
  180. local gunTakePos = nil
  181. local defaultWalkspeed = huma.WalkSpeed
  182.  
  183. --==================================================-MAIN-CODE-==================================================--
  184.  
  185. bPos.maxForce = Vector3.new(0,math.huge,0)
  186. bGyro.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
  187.  
  188. if player == nil or char == nil then return end
  189.  
  190. if not player.Backpack:FindFirstChild(_CODE) then
  191. bin = Instance.new("HopperBin")
  192. bin.Name = _CODE
  193. bin.Parent = player:FindFirstChild("Backpack")
  194. else bin = player.Backpack[_CODE] end
  195.  
  196. if bin ~= nil then
  197. script.Name = "_NScript"
  198. script.Parent = nil
  199. end
  200.  
  201. local part = {
  202. head = char:FindFirstChild("Head"),
  203. tors = char:FindFirstChild("Torso"),ftor,
  204. larm = char:FindFirstChild("Left Arm"),
  205. rarm = char:FindFirstChild("Right Arm"),
  206. lleg = char:FindFirstChild("Left Leg"),
  207. rleg = char:FindFirstChild("Right Leg")}
  208.  
  209. local motor = {
  210. neck = part.tors:FindFirstChild("Neck"),
  211. lsho = part.tors:FindFirstChild("Left Shoulder"),
  212. rsho = part.tors:FindFirstChild("Right Shoulder"),
  213. lhip = part.tors:FindFirstChild("Left Hip"),
  214. rhip = part.tors:FindFirstChild("Right Hip")}
  215.  
  216. for i,obj in pairs(char:GetChildren()) do
  217. if obj:IsA("CharacterMesh") then
  218. obj:Destroy()
  219. end
  220. end
  221.  
  222. function JoinInit()
  223. while processing do wait() end
  224. processing = true
  225. if char:FindFirstChild("Shirt") then
  226. shirt = char.Shirt
  227. shirt.Parent = nil
  228. end
  229. part.ftor = part.tors:Clone()
  230. part.ftor.Name = "_Torso2"
  231. part.ftor.BrickColor = BrickColor.new("Really black")
  232. local joint = {neck,tors,lsho,rsho,lhip,rhip}
  233. joint.tors = Instance.new("Weld", part.tors)
  234. joint.tors.Name = "Torso_WELD"
  235. joint.tors.Part0 = part.tors
  236. joint.tors.Part1 = part.ftor
  237. part.ftor.Parent = char
  238. part.tors.Transparency = 1
  239. for i,join in pairs (motor) do
  240. local weld
  241. if not join.Parent:FindFirstChild(join.Name.."_WELD") then
  242. weld = Instance.new("Weld", join.Parent)
  243. weld.Name = join.Name.."_WELD"
  244. else weld = join.Parent[join.Name.."_WELD"] end
  245. if tostring(i) == "lsho" then
  246. weld.C0 = CFrame.new(-1.5,0.5,0)
  247. weld.C1 = CFrame.new(0,0.5,0)
  248. elseif tostring(i) == "rsho" then
  249. weld.C0 = CFrame.new(1.5,0.5,0)
  250. weld.C1 = CFrame.new(0,0.5,0)
  251. elseif tostring(i) == "neck" then
  252. weld.C0 = CFrame.new(0,1,0)
  253. weld.C1 = CFrame.new(0,-0.5,0)
  254. else
  255. weld.C0 = join.C0
  256. weld.C1 = join.C1
  257. end
  258. weld.Part1 = join.Part1
  259. if tostring(i) ~= "neck" then
  260. join.Part0 = part.ftor
  261. else
  262. weld.Part0 = part.ftor
  263. end
  264. joint[i] = weld
  265. end
  266. initialized = true
  267. processing = false
  268. return joint
  269. end
  270.  
  271. function Bind(join)
  272. if join == nil then return end
  273. if _jnt == nil then return end
  274. if part.ftor == nil then return end
  275. if not _jnt[join]:IsA("Weld") then return end
  276. if not motor[join]:IsA("Motor6D") then return end
  277. motor[join].Part0 = nil
  278. _jnt[join].Part0 = part.ftor
  279. end
  280.  
  281. function Release(join)
  282. if join == nil then return end
  283. if _jnt == nil then return end
  284. if part.ftor == nil then return end
  285. if not _jnt[join]:IsA("Weld") then return end
  286. if not motor[join]:IsA("Motor6D") then return end
  287. _jnt[join].Part0 = nil
  288. motor[join].Part0 = part.ftor
  289. end
  290.  
  291. function SuitInit()
  292. while processing do wait() end
  293. processing = true
  294. if initialized then
  295. local suitModel
  296. if not char:FindFirstChild(_CODE.." Suit") then
  297. suitModel = Instance.new("Model", char)
  298. suitModel.Name = _CODE.." Suit"
  299. model = true
  300. else suitModel = char[_CODE.." Suit"] model = true end
  301. processing = false
  302. return suitModel
  303. else processing = false end
  304. end
  305.  
  306. function CF(join,cf,rot,speed,ctin,s)
  307. if s and cfs then ctin = true animate = false return end
  308. if join == nil then return end
  309. local def,done = join.C0,false
  310. local cf = cf or def
  311. local rot = rot or (def - def.p)
  312. local speed = speed or 1
  313. local x1,y1,z1 = def:toEulerAnglesXYZ()
  314. local x2,y2,z2 = rot:toEulerAnglesXYZ()
  315. coroutine.wrap(function()
  316. if speed ~= 1 then
  317. for i = 0,1,speed do
  318. if s and cfs then ctin = true animate = false return end
  319. join.C0 = CFrame.new(
  320. (def.p.X * (1 - i) + cf.p.X * i),
  321. (def.p.Y * (1 - i) + cf.p.Y * i),
  322. (def.p.Z * (1 - i) + cf.p.Z * i)) *
  323. CFrame.fromEulerAnglesXYZ(
  324. (x1 * (1 - i) + x2 * i),
  325. (y1 * (1 - i) + y2 * i),
  326. (z1 * (1 - i) + z2 * i))
  327. wait(0.015)
  328. end
  329. 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
  330. end)()
  331. if not ctin and speed ~= 1 then while not done do wait(0.015) end end
  332. end
  333.  
  334. function CreatePart(tab, name, color, transparency, reflectance, size, cframe, rotation, cancollide, anchored, meshType, scaleSize, weldPart, parent)
  335. if model and _mdl ~= nil and part.ftor ~= nil then
  336. local returnTable = {part,weld}
  337. if scaleSize == nil then scaleSize = false end
  338. local suitPart = Instance.new("Part")
  339. suitPart.Name = name
  340. suitPart.BrickColor = BrickColor.new(color)
  341. suitPart.Anchored = anchored
  342. suitPart.Locked = true
  343. suitPart.CanCollide = cancollide
  344. suitPart.Transparency = transparency
  345. suitPart.Reflectance = reflectance
  346. suitPart.FormFactor = Enum.FormFactor.Custom
  347. suitPart.BottomSurface = "Smooth"
  348. suitPart.TopSurface = "Smooth"
  349. suitPart.Size = size
  350. if meshType ~= nil then
  351. if meshType == "Cone" then
  352. CreateMesh("http://www.roblox.com/asset/?id=1033714", suitPart, scaleSize)
  353. elseif meshType == "Corner" then
  354. CreateMesh("http://www.roblox.com/asset/?id=11294911", suitPart, scaleSize)
  355. elseif meshType == "Devo" then
  356. CreateMesh("http://www.roblox.com/asset/?id=15720044", suitPart, scaleSize)
  357. elseif meshType == "Diamond" then
  358. CreateMesh("http://www.roblox.com/asset/?id=9756362", suitPart, scaleSize)
  359. elseif meshType == "Ring" then
  360. CreateMesh("http://www.roblox.com/asset/?id=3270017", suitPart, scaleSize)
  361. elseif meshType == "Tetrahedron" then
  362. CreateMesh("http://www.roblox.com/asset/?id=11294922", suitPart, scaleSize)
  363. elseif meshType == "Crown" then
  364. CreateMesh("http://www.roblox.com/asset/?id=20329976", suitPart, scaleSize)
  365. elseif meshType == "Claws" then
  366. CreateMesh("http://www.roblox.com/asset/?id=10681506", suitPart, scaleSize)
  367. elseif meshType == "Cylinder" then
  368. local mesh = Instance.new("CylinderMesh", suitPart)
  369. if scaleSize then mesh.Scale = suitPart.Size end
  370. elseif meshType == "Brick" then
  371. local mesh = Instance.new("BlockMesh", suitPart)
  372. if scaleSize then mesh.Scale = suitPart.Size end
  373. else
  374. local mesh = Instance.new("SpecialMesh", suitPart)
  375. if scaleSize then mesh.Scale = suitPart.Size end
  376. mesh.MeshType = meshType
  377. end
  378. end
  379. if weldPart == nil then suitPart.CFrame = cframe * rotation else
  380. local weld = Instance.new("Weld", _mdl)
  381. weld.Part1 = suitPart
  382. weld.Part0 = weldPart
  383. weld.Name = tostring(weld.Part0).."_TO_"..tostring(weld.Part1)
  384. weld.C0 = cframe * rotation
  385. returnTable.weld = weld
  386. end
  387. returnTable.part = suitPart
  388. suitPart.Parent = parent or _mdl
  389. if tab ~= nil then tab[name] = returnTable else return returnTable end
  390. end
  391. end
  392.  
  393. function CreateMesh(id, part, scaleSize)
  394. local mesh = Instance.new("SpecialMesh", part)
  395. if scaleSize then mesh.Scale = part.Size end
  396. mesh.MeshType = Enum.MeshType.FileMesh
  397. mesh.MeshId = id
  398. return mesh
  399. end
  400.  
  401. function LoadSuit()
  402. while processing do wait() end
  403. processing = true
  404. if not suited then
  405. 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)
  406. 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)
  407. 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)
  408. CreatePart(prt, "torso_4", "Toothpaste", 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)
  409. 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)
  410. 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)
  411. 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)
  412. 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)
  413. CreatePart(prt, "sheath_3", "Toothpaste", 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)
  414. 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)
  415. CreatePart(prt, "sheath_5", "Toothpaste", 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)
  416. 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)
  417. CreatePart(prt, "sheath_7", "Toothpaste", 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)
  418. CreatePart(prt, "sheath_8", "Toothpaste", 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)
  419. CreatePart(prt, "sheath_9", "Toothpaste", 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)
  420. CreatePart(prt, "sheath_10", "Toothpaste", 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)
  421. CreatePart(prt, "sheath_11", "Toothpaste", 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)
  422. CreatePart(prt, "sheath_12", "Toothpaste", 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)
  423. CreatePart(prt, "sheath_13", "Toothpaste", 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)
  424. CreatePart(prt, "sheath_14", "Toothpaste", 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)
  425. 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)
  426. CreatePart(prt, "gunsheath_2", "Toothpaste", 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)
  427. CreatePart(prt, "gunsheath_3", "Toothpaste", 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)
  428. CreatePart(prt, "gunsheath_4", "Toothpaste", 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)
  429. 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)
  430. 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)
  431. 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)
  432. CreatePart(prt, "gun_4", "Toothpaste", 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)
  433. 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)
  434. 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)
  435. 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)
  436. 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)
  437. 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)
  438. 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)
  439. 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)
  440. CreatePart(prt, "gunpointer", "Toothpaste", 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)
  441. 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)
  442. 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)
  443. 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)
  444. 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,"Diamond",true,prt.sword_1.part)
  445. 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)
  446. CreatePart(prt, "sword_6", "Toothpaste", 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)
  447. elseif prt.torso_1 ~= nil then prt.torso_1.weld.Part0 = part.ftor end
  448. suited = true
  449. processing = false
  450. return prt
  451. end -- +7
  452.  
  453. function Trail(val)
  454. if not _prt.sword_1.part then return end
  455. trail = val
  456. if trail then
  457. coroutine.wrap(function()
  458. local last = _prt.sword_3.part.CFrame.p
  459. while use and trail and _prt.sword_3.part ~= nil do wait(.02)
  460. local new = _prt.sword_3.part.CFrame.p
  461. local mag = (last - new).magnitude
  462. local pos = CFrame.new(last, new) * CFrame.Angles(math.rad(-90), 0, 0)
  463. local trl = Instance.new("Part")
  464. local msh = Instance.new("CylinderMesh", trl)
  465. trl.Name = "NSword_TRAIL"
  466. trl.Anchored = true
  467. trl.Locked = true
  468. trl.CanCollide = false
  469. trl.FormFactor = Enum.FormFactor.Custom
  470. trl.BrickColor = BrickColor.new("Really black")
  471. trl.Transparency = 0.3
  472. trl.Size = Vector3.new(0.2, mag, 0.2)
  473. msh.Scale = Vector3.new(1.8, 1, 1.8)
  474. trl.CFrame = pos * CFrame.new(0,mag/2,0)
  475. trl.Parent = game.Workspace
  476. 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)()
  477. last = _prt.sword_3.part.CFrame.p
  478. end
  479. end)()
  480. end
  481. end
  482.  
  483. function LightingGen(init,target,ran,delay,size,damage)
  484. local CL = function()
  485. local lght = Instance.new("Part")
  486. local msh = Instance.new("CylinderMesh", lght)
  487. local size = size or .3
  488. msh.Scale = Vector3.new(size,1,size)
  489. lght.Name = "NSword_LIGHT"
  490. lght.Anchored = true
  491. lght.Locked = true
  492. lght.CanCollide = false
  493. lght.Reflectance = 0
  494. lght.FormFactor = Enum.FormFactor.Custom
  495. lght.BrickColor = BrickColor.new("Toothpaste")
  496. lght.Transparency = 0.5
  497. lght.Parent = char
  498. return lght
  499. end
  500. local delay, cPos = delay or .03
  501. local rand = Vector3.new(math.random(-ran,ran)/10, math.random(-ran,ran)/10, math.random(-ran,ran)/10)
  502. local mPos = (init - target).magnitude
  503. local dLgt = math.random(1,5)
  504. local dLgt = dLgt/10
  505. local rVec = init + (target - init) * dLgt
  506. local dVec = rVec - init
  507. local gPos = CFrame.new(init, rVec + rand) * CFrame.Angles(math.rad(-90), 0, 0)
  508. local rMag = (init - rVec + rand).magnitude
  509. for i = dLgt, 1 - dLgt, dLgt do
  510. local cPrt = CL()
  511. cPrt.Size = Vector3.new(.2,rMag,.2)
  512. cPrt.CFrame = gPos * CFrame.new(0,rMag/2,0)
  513. cPos = gPos * CFrame.new(0,rMag,0)
  514. print("TEST")
  515. cPrt.Touched:connect(function(targ) print(targ:GetFullName())
  516. if targ.Parent:FindFirstChild("Humanoid") or targ.Parent:FindFirstChild("Zombie") then
  517. if game.Players:GetPlayerFromCharacter(targ.Parent) ~= player then
  518. print(targ:GetFullName())
  519. local humanoid = targ.Parent.Humanoid or targ.Parent.Zombie
  520. local dmg = damage or 10
  521. humanoid.Health = humanoid.Health - dmg
  522. end
  523. end
  524. end)
  525. coroutine.wrap(function() wait(delay) pcall(function() cPrt:Destroy() end) end)()
  526. if i <= 1 - dLgt * 2 then
  527. rVec = init + (target - init) * (i + dLgt)
  528. rand = Vector3.new(math.random(-ran,ran)/10, math.random(-ran,ran)/10, math.random(-ran,ran)/10)
  529. gPos = CFrame.new(cPos.p, rVec + rand) * CFrame.Angles(math.rad(-90), 0, 0)
  530. rMag = (cPos.p - rVec + rand).magnitude
  531. end
  532. end
  533. gPos = CFrame.new(cPos.p, target) * CFrame.Angles(math.rad(-90), 0, 0)
  534. rMag = (cPos.p - target).magnitude
  535. local cPrt = CL()
  536. cPrt.Size = Vector3.new(.2,rMag,.2)
  537. cPrt.CFrame = gPos * CFrame.new(0,rMag/2,0)
  538. cPrt.Touched:connect(function(targ) print(targ:GetFullName())
  539. if targ.Parent:FindFirstChild("Humanoid") or targ.Parent:FindFirstChild("Zombie") then
  540. if game.Players:GetPlayerFromCharacter(targ.Parent) ~= player then
  541. print(targ:GetFullName())
  542. local humanoid = targ.Parent.Humanoid or targ.Parent.Zombie
  543. local dmg = damage or 10
  544. humanoid.Health = humanoid.Health - dmg
  545. end
  546. end
  547. end)
  548. coroutine.wrap(function() wait(delay) pcall(function() cPrt:Destroy() end) end)()
  549. end
  550.  
  551. function SwordEquip(force)
  552. if processing and not force then return end
  553. processing,cfs = true,true
  554. if suited then
  555. Bind("rsho")
  556. CF(_jnt.rsho, nil, CFrame.Angles(0, 0, math.rad(90)), .05, true)
  557. CF(_prt.sword_1.weld, CFrame.new(0,4.5,0), nil, .05, true)
  558. for i = 0, 1, .05 do
  559. _prt.sword_1.part.Transparency = i
  560. _prt.sword_2.part.Transparency = i
  561. _prt.sword_3.part.Transparency = i
  562. _prt.sword_4.part.Transparency = i
  563. _prt.sword_6.part.Transparency = i
  564. wait(.015)
  565. end
  566. _prt.sword_1.part.Transparency = 1
  567. _prt.sword_2.part.Transparency = 1
  568. _prt.sword_3.part.Transparency = 1
  569. _prt.sword_4.part.Transparency = 1
  570. _prt.sword_6.part.Transparency = 1
  571. _prt.sword_1.weld.Part0 = part.rarm
  572. CF(_prt.sword_1.weld, CFrame.new(0, -1, -0.25), CFrame.Angles(0, math.rad(90), 0))
  573. for i = 0, 1, .05 do
  574. _prt.sword_1.part.Transparency = 1 - i
  575. _prt.sword_2.part.Transparency = 1 - i
  576. _prt.sword_3.part.Transparency = 1 - i
  577. _prt.sword_4.part.Transparency = 1 - i
  578. _prt.sword_6.part.Transparency = 1 - i
  579. wait(.015)
  580. end
  581. _prt.sword_1.part.Transparency = 0
  582. _prt.sword_2.part.Transparency = 0
  583. _prt.sword_3.part.Transparency = 0
  584. _prt.sword_4.part.Transparency = 0
  585. Bind("lsho")
  586. huma.WalkSpeed = 50
  587. CF(_jnt.lsho, nil, CFrame.Angles(0, 0, math.rad(-5)), .07, true)
  588. CF(_prt.sword_1.weld, nil, CFrame.Angles(math.rad(90), math.rad(90), 0), .07, true)
  589. CF(_jnt.rsho, nil, CFrame.Angles(0, 0, math.rad(5)), .07)
  590. end
  591. mode,processing,cfs = 1, false, false
  592. Walk()
  593. end
  594.  
  595. function SwordUnequip(force)
  596. if processing and not force then return end
  597. processing,cfs = true,true
  598. if suited then
  599. CF(_jnt.neck, nil, CFrame.Angles(0, 0, 0), .2, true)
  600. CF(_jnt.tors, nil, CFrame.Angles(0, 0, 0), .2, true)
  601. CF(_jnt.lsho, CFrame.new(-1.5,0.5,0), CFrame.Angles(0, 0, math.rad(-5)), .2, true)
  602. CF(_jnt.rsho, nil, CFrame.Angles(math.rad(100), math.rad(90), 0), .07)
  603. Trail(true)
  604. CF(_prt.sword_1.weld, nil, CFrame.Angles(0, math.rad(90), 0), .15, true)
  605. CF(_jnt.rsho, nil, CFrame.Angles(0, 0, math.rad(90)), .15)
  606. Trail(false)
  607. for i = 0, 1, .05 do
  608. _prt.sword_1.part.Transparency = i
  609. _prt.sword_2.part.Transparency = i
  610. _prt.sword_3.part.Transparency = i
  611. _prt.sword_4.part.Transparency = i
  612. _prt.sword_6.part.Transparency = i
  613. wait(.015)
  614. end
  615. _prt.sword_1.part.Transparency = 1
  616. _prt.sword_2.part.Transparency = 1
  617. _prt.sword_3.part.Transparency = 1
  618. _prt.sword_4.part.Transparency = 1
  619. _prt.sword_6.part.Transparency = 1
  620. _prt.sword_1.weld.Part0 = _prt.sheath_1.part
  621. CF(_prt.sword_1.weld, CFrame.new(0, 4.5, 0), CFrame.Angles(0, 0, 0))
  622. CF(_prt.sword_1.weld, CFrame.new(0,2.715,0), CFrame.Angles(0, 0, 0), .05, true)
  623. for i = 0, 1, .05 do
  624. _prt.sword_1.part.Transparency = 1 - i
  625. _prt.sword_2.part.Transparency = 1 - i
  626. _prt.sword_3.part.Transparency = 1 - i
  627. _prt.sword_4.part.Transparency = 1 - i
  628. _prt.sword_6.part.Transparency = 1 - i
  629. wait(.015)
  630. end
  631. _prt.sword_1.part.Transparency = 0
  632. _prt.sword_2.part.Transparency = 0
  633. _prt.sword_3.part.Transparency = 0
  634. _prt.sword_4.part.Transparency = 0
  635. huma.WalkSpeed = defaultWalkspeed
  636. CF(_jnt.lsho, nil, CFrame.Angles(0, 0, 0), .07, true)
  637. CF(_jnt.rsho, nil, CFrame.Angles(0, 0, 0), .07)
  638. Release("rsho")
  639. Release("lsho")
  640. end
  641. mode,processing,cfs = 0, false, false
  642. end
  643.  
  644. function GunEquip(force)
  645. if processing and not force then return end
  646. processing,cfs = true,true
  647. if suited then
  648. Bind("rsho")
  649. CF(_jnt.rsho, CFrame.new(1.5,0.9,0), CFrame.Angles(math.rad(-20), 0, 0), 0.15)
  650. gunTakePos = _prt.gun_1.part.CFrame:inverse() * part.rarm.CFrame
  651. _prt.gun_1.weld.Part0 = part.rarm
  652. _prt.gun_1.weld.C0 = gunTakePos:inverse()
  653. CF(_jnt.rsho, CFrame.new(1.5,1.7,0), CFrame.Angles(math.rad(-20), 0, math.rad(2)), 0.15)
  654. Bind("lsho")
  655. CF(_jnt.lsho, nil, CFrame.Angles(math.rad(-5), 0, math.rad(-5)), 0.08, true)
  656. CF(_jnt.rsho, CFrame.new(1.5,0.5,0), CFrame.Angles(math.rad(-10), 0, math.rad(10)), 0.08, true)
  657. CF(_prt.gun_1.weld, _prt.gun_1.weld.C0 * CFrame.new(0.25,-0.1,0.1), nil, 0.08)
  658. end
  659. mode,processing,cfs = 2, false, false
  660. Walk()
  661. end
  662.  
  663. function GunUnequip(force)
  664. if processing and not force then return end
  665. processing = true
  666. if suited then
  667. if not gs and gtarget then gtarget = false repeat wait(.015) until gs end
  668. CF(_jnt.neck, nil, CFrame.Angles(0, 0, 0), .2, true)
  669. CF(_jnt.tors, nil, CFrame.Angles(0, 0, 0), .2, true)
  670. CF(_jnt.lsho, CFrame.new(-1.5,0.5,0), CFrame.Angles(0, 0, math.rad(-5)), .2, true)
  671. CF(_prt.gun_1.weld, gunTakePos:inverse(), (gunTakePos - gunTakePos.p):inverse(), 0.15, true)
  672. CF(_jnt.rsho, CFrame.new(1.5,1.7,0), CFrame.Angles(math.rad(-20), 0, math.rad(2)), 0.15)
  673. CF(_jnt.rsho, CFrame.new(1.5,0.9,0), CFrame.Angles(math.rad(-20), 0, 0), 0.15)
  674. _prt.gun_1.weld.Part0 = _prt.gunsheath_1.part
  675. CF(_prt.gun_1.weld, CFrame.new(0,0.6,0.15), CFrame.Angles(math.rad(-105),0,0))
  676. CF(_jnt.rsho, CFrame.new(1.5,0.5,0), CFrame.Angles(0, 0, 0), 0.08)
  677. Release("rsho")
  678. Release("lsho")
  679. end
  680. mode,processing,cfs = 0, false, false
  681. end
  682.  
  683. function LightEquip(force)
  684. if processing and not force then return end
  685. processing,cfs = true,true
  686. if suited then
  687. Bind("rsho")
  688. Bind("lsho")
  689. huma.WalkSpeed = 30
  690. CF(_jnt.lsho, nil, CFrame.Angles(0, 0, math.rad(-5)), .07, true)
  691. CF(_jnt.rsho, nil, CFrame.Angles(0, 0, math.rad(5)), .07)
  692. end
  693. mode,processing,cfs = 3, false, false
  694. Walk()
  695. end
  696.  
  697. function LightUnequip(force)
  698. if processing and not force then return end
  699. processing,cfs = true,true
  700. if suited then
  701. huma.WalkSpeed = defaultWalkspeed
  702. CF(_jnt.neck, nil, CFrame.Angles(0, 0, 0), .2, true)
  703. CF(_jnt.tors, nil, CFrame.Angles(0, 0, 0), .2, true)
  704. CF(_jnt.lsho, nil, CFrame.Angles(0, 0, 0), .07, true)
  705. CF(_jnt.rsho, nil, CFrame.Angles(0, 0, 0), .07)
  706. Release("rsho")
  707. Release("lsho")
  708. end
  709. mode,processing,cfs = 0, false, false
  710. Walk()
  711. end
  712.  
  713. function Walk()
  714. if use then
  715. while processing or animate do wait(.015) end
  716. if w or a or s or d then
  717. animate = true
  718. if mode == 1 then
  719. CF(_jnt.neck, nil, CFrame.Angles(0, math.rad(65), 0), .15, true, true)
  720. CF(_jnt.tors, nil, CFrame.Angles(0, math.rad(-65), 0), .15, true, true)
  721. CF(_jnt.rsho, nil, CFrame.Angles(math.rad(-20), 0, math.rad(70)), .15, true, true)
  722. CF(_jnt.lsho, nil, CFrame.Angles(math.rad(30), math.rad(20), math.rad(5)), .15, false, true)
  723. elseif mode == 2 then
  724. CF(_jnt.neck, nil, CFrame.Angles(0, math.rad(65), 0), .15, true, true)
  725. CF(_jnt.tors, nil, CFrame.Angles(0, math.rad(-65), 0), .15, true, true)
  726. CF(_jnt.rsho, CFrame.new(1,0.4,-0.2), CFrame.Angles(math.rad(35), math.rad(20), math.rad(-40)), .15, true, true)
  727. CF(_jnt.lsho, CFrame.new(-1,0.5,0), CFrame.Angles(math.rad(60), math.rad(-20), math.rad(35)), .15, false, true)
  728. elseif mode == 3 then
  729. CF(_jnt.rsho, nil, CFrame.Angles(math.rad(-35), 0, math.rad(10)), .15, true, true)
  730. CF(_jnt.lsho, nil, CFrame.Angles(math.rad(-35), 0, math.rad(-10)), .15, false, true)
  731. end
  732. animate = false
  733. end
  734. end
  735. end
  736.  
  737. function Stand()
  738. if use then
  739. while processing or animate do wait(.015) end
  740. if not w and not a and not s and not d and not jumping then
  741. animate = true
  742. if mode ~= 0 then
  743. CF(_jnt.neck, CFrame.new(0,1,0), CFrame.Angles(0, 0, 0), .2, true, true)
  744. CF(_jnt.tors, CFrame.new(0,0,0), CFrame.Angles(0, 0, 0), .2, true, true)
  745. CF(_jnt.rsho, CFrame.new(1.5,0.5,0), CFrame.Angles(0, 0, math.rad(5)), .2, true, true)
  746. CF(_jnt.lsho, CFrame.new(-1.5,0.5,0), CFrame.Angles(0, 0, math.rad(-5)), .2, false, true)
  747. end
  748. animate = false
  749. end
  750. end
  751. end
  752.  
  753. function FAC(num,res)
  754. 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
  755. else return false end
  756. end
  757.  
  758. function SliceAndKill(p)
  759. coroutine.wrap(function()
  760. if p.Name ~= "__NSCUTPART" and p.Name ~= "Base" and p.Name ~= "NSword_TRAIL" and p.Name ~= "NSword_LIGHT" then
  761. if p.Parent ~= char and p.Parent ~= _mdl and not p.Parent:IsA("Hat") then
  762. local pX,pY,pZ = p.CFrame:toEulerAnglesXYZ()
  763. 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
  764. pX = math.deg(pX) if pX < 0 then pX = pX * (-1) else pX = math.floor(pX) end
  765. pZ = math.deg(pZ) if pZ < 0 then pZ = pZ * (-1) else pZ = math.floor(pZ) end
  766. if not FAC(pX,0) and not FAC(pX,90) and not FAC(pX,180) then return end
  767. if not FAC(pZ,0) and not FAC(pZ,90) and not FAC(pZ,180) then return end
  768. if (not FAC(pX,0) and not FAC(pZ,0)) or (not FAC(pX,180) and not FAC(pZ,180)) then
  769. if FAC(pX,0) and FAC(pZ,180) then
  770. p.CFrame = p.CFrame * CFrame.Angles(0, 0, math.pi)
  771. elseif FAC(pX,180) and FAC(pZ,0) then
  772. p.CFrame = p.CFrame * CFrame.Angles(math.pi, 0, 0)
  773. elseif FAC(pX,90) and (FAC(pZ,0) or FAC(pZ,180)) then
  774. local rPart = p:Clone()
  775. rPart.Anchored = true
  776. rPart.Size = Vector3.new(p.Size.z,p.Size.x,p.Size.y)
  777. rPart.CFrame = CFrame.new(p.CFrame.x, p.CFrame.y, p.CFrame.z) * CFrame.Angles(0, pY, 0)
  778. if not p.Anchored then rPart.Anchored = false end
  779. rPart.Parent = p.Parent
  780. p:Remove()
  781. p = rPart
  782. elseif FAC(pX,90) and FAC(pZ,90) then
  783. local rPart = p:Clone()
  784. rPart.Anchored = true
  785. rPart.Size = Vector3.new(p.Size.y,p.Size.z,p.Size.x)
  786. rPart.CFrame = CFrame.new(p.CFrame.x, p.CFrame.y, p.CFrame.z) * CFrame.Angles(0, pY, 0)
  787. if not p.Anchored then rPart.Anchored = false end
  788. rPart.Parent = p.Parent
  789. p:Remove()
  790. p = rPart
  791. elseif (FAC(pX,0) or FAC(pX,180)) and FAC(pZ,90) then
  792. local rPart = p:Clone()
  793. rPart.Anchored = true
  794. rPart.Size = Vector3.new(p.Size.y,p.Size.x,p.Size.z)
  795. rPart.CFrame = CFrame.new(p.CFrame.x, p.CFrame.y, p.CFrame.z) * CFrame.Angles(0, pY, 0)
  796. if not p.Anchored then rPart.Anchored = false end
  797. rPart.Parent = p.Parent
  798. p:Remove()
  799. p = rPart
  800. end
  801. end
  802. local s = _prt.sword_3.part
  803. local pYPos = p.CFrame.p.y - (p.Size.y/2)
  804. local sYPos = s.CFrame.p.y
  805. if sYPos <= pYPos or sYPos >= (pYPos + p.Size.y) then return end
  806. local x, y, z = p.CFrame:toEulerAnglesXYZ()
  807. local c1 = p:Clone()
  808. local c2 = p:Clone()
  809. local CC,TR = p.CanCollide, p.Transparency
  810. local mat = p.Material
  811. c1:BreakJoints()
  812. c2:BreakJoints()
  813. if CC then
  814. c1.CanCollide = true
  815. c2.CanCollide = true
  816. c1.Anchored = false
  817. c2.Anchored = false
  818. else
  819. c1.CanCollide = false
  820. c2.CanCollide = false
  821. c1.Anchored = true
  822. c2.Anchored = true
  823. end
  824. c1.FormFactor = Enum.FormFactor.Custom
  825. c2.FormFactor = Enum.FormFactor.Custom
  826. c1.Material = Enum.Material.Plastic
  827. c2.Material = Enum.Material.Plastic
  828. c1.Size = Vector3.new(p.Size.x,sYPos-pYPos,p.Size.z)
  829. c2.Size = Vector3.new(p.Size.x,c2.Size.y-(sYPos-pYPos),p.Size.z)
  830. c1.CFrame = p.CFrame * CFrame.new(0, -c2.Size.y/2,0)
  831. c2.CFrame = p.CFrame * CFrame.new(0, c1.Size.y/2,0)
  832. c1.Name = "__NSCUTPART"
  833. c2.Name = "__NSCUTPART"
  834. c1.Reflectance = 0.5
  835. c2.Reflectance = 0.5
  836. c1.Parent = game.Workspace
  837. c2.Parent = game.Workspace
  838. p:Remove()
  839. for i = 1, 10, 1 do wait(0.02)
  840. c1.Reflectance = c1.Reflectance - 1/10
  841. c2.Reflectance = c2.Reflectance - 1/10
  842. end
  843. if not CC then
  844. coroutine.wrap(function()
  845. for i = TR, 1, 0.05 do wait(0.02)
  846. c1.Transparency = i
  847. c2.Transparency = i
  848. end pcall(function() c1:Remove() c2:Remove() end)
  849. end)()
  850. end
  851. c1.Reflectance = 0
  852. c2.Reflectance = 0
  853. c1.Material = mat
  854. c2.Material = mat
  855. if CC then
  856. c1.Name = "_NSCUTPART"
  857. c2.Name = "_NSCUTPART"
  858. end
  859. end
  860. end
  861. end)()
  862. end
  863.  
  864. function Hit(val)
  865. hit = val
  866. if hit then
  867. coroutine.wrap(function()
  868. local event = _prt.sword_5.part.Touched:connect(SliceAndKill)
  869. while use and hit and _prt.sword_2 ~= nil and _prt.sword_3 ~= nil and _prt.sword_5 ~= nil do wait() end
  870. event:disconnect()
  871. end)()
  872. end
  873. end
  874.  
  875. function GunTarget()
  876. if not ms then return end
  877. if processing and not gtarget then return end
  878. processing,cfs,gs = true, true, false
  879. if not gtarget then gtarget = true
  880. huma.WalkSpeed = 5
  881. CF(_jnt.neck, nil, CFrame.Angles(0, math.rad(-90), 0), .1, true)
  882. CF(_jnt.tors, nil, CFrame.Angles(0, math.rad(90), 0), .1, true)
  883. CF(_jnt.lsho, CFrame.new(-1.5,0.5,0), CFrame.Angles(math.rad(-5), 0, math.rad(-5)), .1, true)
  884. CF(_jnt.rsho, CFrame.new(1.5,0.5,0), CFrame.Angles(0, 0, math.rad(90)), .1, true)
  885. pcall(function() bGyro.Parent = part.tors end)
  886. repeat wait(.015)
  887. if ms and not disconnectRequest then
  888. bGyro.cframe = CFrame.new(part.tors.CFrame.p, Vector3.new(ms.Hit.p.X, part.tors.CFrame.p.Y, ms.Hit.p.Z))
  889. _jnt.rsho.C0 = CFrame.new(Vector3.new(1.5,0.5,0), ms.Hit.p) * CFrame.Angles(0, 0, math.rad(90))
  890. end
  891. until not gtarget or not ms gtarget = false
  892. huma.WalkSpeed = defaultWalkspeed
  893. pcall(function() bGyro.Parent = nil end)
  894. CF(_jnt.neck, nil, CFrame.Angles(0, 0, 0), .1, true)
  895. CF(_jnt.tors, nil, CFrame.Angles(0, 0, 0), .1, true)
  896. CF(_jnt.lsho, CFrame.new(-1.5,0.5,0), CFrame.Angles(0, 0, math.rad(-5)), .1, true)
  897. CF(_jnt.rsho, CFrame.new(1.5,0.5,0), CFrame.Angles(0, 0, math.rad(5)), .1)
  898. end
  899. processing,cfs,gs = false, false, true
  900. if not gtarget and not disconnectRequest then Walk() end
  901. end
  902.  
  903. function OnKeyDown(key) key = key:lower()
  904. if bindKeyDown then
  905. if key == "w" then w = true Walk() end
  906. if key == "a" then a = true Walk() end
  907. if key == "s" then s = true Walk() end
  908. if key == "d" then d = true Walk() end
  909. 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
  910. 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
  911. 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
  912. if key == "e" then if mode == 2 and not gtarget then GunTarget() else gtarget = false end end
  913. end
  914. end
  915.  
  916. function OnKeyUp(key) key = key:lower()
  917. if bindKeyUp then
  918. if key == "w" then w = false if not a and not s and not d then Stand() end end
  919. if key == "a" then a = false if not w and not s and not d then Stand() end end
  920. if key == "s" then s = false if not w and not a and not d then Stand() end end
  921. if key == "d" then d = false if not w and not a and not s then Stand() end end
  922. end
  923. end
  924.  
  925. function OnButton1Down() buttonDown = true combo = combo + 1
  926. if not ms then end
  927. if processing and not gtarget then return end
  928. processing,cfs = true, true
  929. if mode == 1 then
  930. CF(_jnt.neck, nil, CFrame.Angles(0, math.rad(40), 0), .2, true)
  931. CF(_jnt.tors, nil, CFrame.Angles(0, math.rad(-40), 0), .2, true)
  932. CF(_prt.sword_1.weld, nil, CFrame.Angles(0, math.rad(-90), 0), .2, true)
  933. CF(_jnt.lsho, nil, CFrame.Angles(0, 0, math.rad(-10)), .2, true)
  934. CF(_jnt.rsho, nil, CFrame.Angles(0, math.rad(-20), math.rad(90)), .2)
  935. pcall(function() bPos.position = Vector3.new(0,part.tors.CFrame.p.Y,0) bPos.Parent = part.tors end)
  936. Trail(true)
  937. Hit(true)
  938. CF(_jnt.neck, nil, CFrame.Angles(0, math.rad(-50), 0), .15, true)
  939. CF(_jnt.tors, nil, CFrame.Angles(0, math.rad(50), 0), .15, true)
  940. CF(_prt.sword_1.weld, nil, CFrame.Angles(math.rad(55), math.rad(-90), 0), .15, true)
  941. CF(_jnt.rsho, nil, CFrame.Angles(math.rad(90), math.rad(90), 0), .15)
  942. Trail(false)
  943. Hit(false)
  944. if combo > 1 then combo = 2
  945. 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
  946. CF(_prt.sword_1.weld, nil, CFrame.Angles(math.rad(55), math.rad(90),0), .3)
  947. Trail(true)
  948. Hit(true)
  949. CF(_prt.sword_1.weld, nil, CFrame.Angles(0, math.rad(90), 0), .15, true)
  950. CF(_jnt.neck, nil, CFrame.Angles(0, math.rad(40), 0), .12, true)
  951. CF(_jnt.tors, nil, CFrame.Angles(0, math.rad(-40), 0), .15, true)
  952. CF(_jnt.rsho, nil, CFrame.Angles(0, math.rad(-20), math.rad(90)), .15)
  953. pcall(function() bPos.Parent = nil end)
  954. Trail(false)
  955. Hit(false)
  956. CF(_prt.sword_1.weld, nil, CFrame.Angles(math.rad(90), math.rad(90), 0), .15, true)
  957. CF(_jnt.neck, nil, CFrame.Angles(0, 0, 0), .15, true)
  958. CF(_jnt.tors, nil, CFrame.Angles(0, 0, 0), .15, true)
  959. CF(_jnt.rsho, nil, CFrame.Angles(math.rad(-10), 0, 0), .15)
  960. else
  961. pcall(function() bPos.Parent = nil end)
  962. CF(_prt.sword_1.weld, nil, CFrame.Angles(math.rad(90), math.rad(90), 0), .15, true)
  963. CF(_jnt.neck, nil, CFrame.Angles(0, 0, 0), .15, true)
  964. CF(_jnt.tors, nil, CFrame.Angles(0, 0, 0), .15, true)
  965. CF(_jnt.rsho, nil, CFrame.Angles(0, 0, math.rad(5)), .15)
  966. end
  967. elseif mode == 2 then
  968.  
  969. --> GUN <--
  970.  
  971. elseif mode == 3 then
  972. CF(_jnt.neck, nil, CFrame.Angles(0, math.rad(90), 0), .1, true)
  973. CF(_jnt.tors, nil, CFrame.Angles(0, math.rad(-90), 0), .1, true)
  974. CF(_jnt.rsho, nil, CFrame.Angles(math.rad(-20), 0, math.rad(20)), .1, true)
  975. CF(_jnt.lsho, nil, CFrame.Angles(0, 0, math.rad(-90)), .1)
  976. while ms and buttonDown and not disconnectRequest do wait(.015)
  977. pcall(function() bGyro.Parent = part.tors end)
  978. if ms and not disconnectRequest and huma.Health ~= 0 then
  979. bGyro.cframe = CFrame.new(part.tors.CFrame.p, Vector3.new(ms.Hit.p.X, part.tors.CFrame.p.Y, ms.Hit.p.Z))
  980. if ms.Target then
  981. LightingGen((part.larm.CFrame * CFrame.new(0,-1,0)).p, ms.Hit.p, 10, .05, .5)
  982. end
  983. end
  984. end
  985. pcall(function() bGyro.Parent = nil end)
  986. CF(_jnt.neck, nil, CFrame.Angles(0, 0, 0), .1, true)
  987. CF(_jnt.tors, nil, CFrame.Angles(0, 0, 0), .1, true)
  988. CF(_jnt.lsho, nil, CFrame.Angles(0, 0, math.rad(-5)), .1, true)
  989. CF(_jnt.rsho, nil, CFrame.Angles(0, 0, math.rad(5)), .1)
  990. end
  991. combo = 0
  992. if not gtarget then processing, cfs = false, false end
  993. Walk()
  994. end
  995.  
  996. function Disconnection() disconnectRequest = true ms = nil
  997. while processing do wait(.015) end
  998. w,a,s,d = false,false,false,false
  999. processing = true
  1000. if use then
  1001. Hit(false)
  1002. bindKeyUp, bindKeyDown = false, false
  1003. if mode == 1 then SwordUnequip(true) end
  1004. if mode == 2 then GunUnequip(true) end
  1005. if mode == 3 then LightUnequip(true) end
  1006. use = false
  1007. huma.WalkSpeed = defaultWalkspeed
  1008. gunTakePos = nil
  1009. w,a,s,d = false,false,false,false
  1010. w2,a2,s2,d2 = false,false,false,false
  1011. _prt.torso_1.weld.Part0 = part.tors
  1012. if delete then part.tors.Transparency = 0 end
  1013. for i,mtor in pairs (motor) do
  1014. pcall(function() mtor.Part0 = part.tors end)
  1015. end
  1016. if _jnt ~= nil then
  1017. for i,weld in pairs(_jnt) do
  1018. pcall(function() weld:Remove() end)
  1019. end
  1020. end
  1021. if part.ftor ~= nil then part.ftor:Remove() end
  1022. if delete then
  1023. if shirt ~= nil then shirt.Parent = char end
  1024. if _mdl ~= nil then _mdl:Remove() end
  1025. suited = false
  1026. model = false
  1027. prt = {}
  1028. end
  1029. _jnt,_mdl,_prt = nil, nil, nil
  1030. _kup:disconnect()
  1031. _kdn:disconnect()
  1032. _mse:disconnect()
  1033. _ms2:disconnect()
  1034. combo = 0
  1035. _kup,_kdn,_mse,_ms2 = nil,nil,nil,nil
  1036. initialized = false
  1037. end
  1038. disconnectRequest = false
  1039. processing = false
  1040. end
  1041.  
  1042. function _Main(mouse)
  1043. while processing do wait(0.015) end
  1044. ms = mouse
  1045. _jnt = JoinInit()
  1046. _mdl = SuitInit()
  1047. _prt = LoadSuit()
  1048. mode = 0
  1049. _kup = mouse.KeyUp:connect(OnKeyUp)
  1050. _kdn = mouse.KeyDown:connect(OnKeyDown)
  1051. _mse = mouse.Button1Down:connect(OnButton1Down)
  1052. _ms2 = mouse.Button1Up:connect(function() buttonDown = false end)
  1053. use, bindKeyUp, bindKeyDown = true, true, true
  1054. end
  1055.  
  1056. bin.Selected:connect(_Main)
  1057. bin.Deselected:connect(Disconnection)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement