derekiscool423

guardian fighter

Dec 11th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.39 KB | None | 0 0
  1. Player=game:GetService("Players").LocalPlayer
  2. Char=Player.Character
  3. Backpack=Player.Backpack
  4. PlayerGui=Player.PlayerGui
  5. Torso=Char.Torso
  6. Head=Char.Head
  7. Hum=Char.Humanoid
  8. Cam=workspace.CurrentCamera
  9. Tn="Guardian Fighter"
  10.  
  11. pcall(function() Backpack[Tn]:Remove() end)
  12. pcall(function() Cam[Tn]:Remove() end)
  13. pcall(function() thesuit=Char[''] end)
  14. pcall(function() thesuit[Tn]:Remove() end)
  15. pcall(function() PlayerGui[Tn]:Remove() end)
  16. pcall(function() Char.Block:Remove() end)
  17. pcall(function() Char.HumanoidJointPart['BodyGyro']:Remove() end)
  18.  
  19. CModel=qi{'Model',Cam,Name=Tn}
  20. Tool=qi{'HopperBin',Player.Backpack,Name=Tn}
  21. Suit=qi{'Model',Char,Name=''}
  22. Weapon=qi{'Model',Suit,Name=Tn}
  23. Gui=qi{'ScreenGui',PlayerGui,Name=Tn}
  24. Block=qi{'NumberValue',Char,Name='Block'}
  25.  
  26. equip="unequipped"
  27. anim=""
  28. keys={}
  29. fmouse=nil
  30. running=false
  31. Combo=0
  32.  
  33. ids = {}
  34. ids.Slash = 10209645
  35. ids.Slash2 = 46760716
  36. ids.Slash3 = 10209640
  37. ids.ShieldBash = 2692806
  38. ids.Spike = 1033714
  39. ids.Hit = 10209590
  40. ids.Shine = 48965808
  41. ids.Ring = 3270017
  42. ids.BladeTip = 9756362
  43. ids.Block = 'rbxasset://sounds\\metal.ogg'
  44.  
  45. for i,v in pairs(ids) do
  46. if type(v)=='number' then
  47. ids[i]='http://www.roblox.com/asset/?id='..v
  48. end
  49. game:GetService("ContentProvider"):Preload(ids[i])
  50. end
  51.  
  52. Limbs={LS=Torso:findFirstChild'Left Shoulder',RS=Torso:findFirstChild'Right Shoulder',LH=Torso:findFirstChild'Left Hip',RH=Torso:findFirstChild'Right Hip'}
  53. if _G.Limbz then
  54. Limbs.LS=Limbs.LS or _G.Limbz.LS
  55. Limbs.RS=Limbs.RS or _G.Limbz.RS
  56. Limbs.LH=Limbs.LH or _G.Limbz.LH
  57. Limbs.RH=Limbs.RH or _G.Limbz.RH
  58. end
  59. _G.Limbz=Limbs
  60. Torso.Neck.C0=cn(0,1.5,0) Torso.Neck.C1=cn(0,0,0)
  61. LS,RS,LH,RH=Limbs.LS,Limbs.RS,Limbs.LH,Limbs.RH
  62. LA,RA,LL,RL=Char['Left Arm'],Char['Right Arm'],Char['Left Leg'],Char['Right Leg']
  63. LS.Part0,RS.Part0,LH.Part0,RH.Part0=Torso,Torso,Torso,Torso
  64. LS.Part1,RS.Part1,LH.Part1,RH.Part1=LA,RA,LL,RL
  65.  
  66. pcall(function() thesuit:Remove() end)
  67.  
  68. fTorso=Char.HumanoidRootPart tw=fTorso.RootJoint hw=Torso.Neck c2(tw,1,3,0,0,0,90,180,0)
  69. la=qi{'Weld',Torso,Part0=Torso,C0=cn(-1.5,0.5,0),C1=cn(0,0.5,0)} ra=qi{'Weld',Torso,Part0=Torso,C0=cn(1.5,0.5,0),C1=cn(0,0.5,0)}
  70. ll=qi{'Weld',Torso,Part0=Torso,C0=cn(-0.5,-1,0),C1=cn(0,1,0)} rl=qi{'Weld',Torso,Part0=Torso,C0=cn(0.5,-1,0),C1=cn(0,1,0)}
  71.  
  72. Arms = function(on)
  73. if on then
  74. LS.Part1=nil RS.Part1=nil
  75. la.Part0=Torso ra.Part0=Torso
  76. la.Part1=LA ra.Part1=RA
  77. la.C0,la.C1=cn(-1.5,0.5,0),cn(0,0.5,0)
  78. ra.C0,ra.C1=cn(1.5,0.5,0),cn(0,0.5,0)
  79. else
  80. LS.Parent,RS.Parent=Torso,Torso
  81. LS.Part0=Torso
  82. RS.Part0=Torso
  83. LS.Part1=LA
  84. RS.Part1=RA
  85. la.Part1=nil ra.Part1=nil
  86. end
  87. end
  88.  
  89. Legs = function(on)
  90. if on then
  91. LH.Part1=nil RH.Part1=nil
  92. ll.Part0=Torso rl.Part0=Torso
  93. ll.Part1=LL rl.Part1=RL
  94. ll.C0,ll.C1=cn(-0.5,-1,0),cn(0,1,0)
  95. rl.C0,rl.C1=cn(0.5,-1,0),cn(0,1,0)
  96. else
  97. LH.Parent,RH.Parent=Torso,Torso
  98. LH.Part0=Torso
  99. RH.Part0=Torso
  100. LH.Part1=LL
  101. RH.Part1=RL
  102. ll.Part1=nil rl.Part1=nil
  103. end
  104. end
  105.  
  106. function Design(c)
  107. ha=pa(Weapon,"1","Block",0.3,1,0.3,false,false,0,0,c[1]) haw=weld(ha,Torso,ha,-1,-1,0,0,rd(90),rd(110)) qi{"CylinderMesh",ha}
  108. sp=pa(Weapon,"1","Block",0.4,0.4,0.4,false,false,0,0,c[1]) weld(sp,ha,sp,0,-0.5,0,0,0,0) qi{"SpecialMesh",sp,MeshType="Sphere"}
  109. hap=pa(Weapon,"1","Block",0.5,0,0.3,false,false,0,0,c[1]) weld(hap,ha,hap,0,0.6,0,0,0,0)
  110. sp=pa(Weapon,"1","Block",1,1,1,false,false,0,0,c[1]) weld(sp,hap,sp,0.25+0.125,0,-0.075,0,0,rd(-90)) qi{"SpecialMesh",sp,MeshType="Wedge",Scale=v3(0.2,0.25,0.15)}
  111. sp=pa(Weapon,"1","Block",1,1,1,false,false,0,0,c[1]) weld(sp,hap,sp,-0.25-0.125,0,-0.075,0,0,rd(90)) qi{"SpecialMesh",sp,MeshType="Wedge",Scale=v3(0.2,0.25,0.15)}
  112. sp=pa(Weapon,"1","Block",1,1,1,false,false,0,0,c[1]) weld(sp,hap,sp,-0.25-0.125,0,0.075,0,rd(-180),rd(-90)) qi{"SpecialMesh",sp,MeshType="Wedge",Scale=v3(0.2,0.25,0.15)}
  113. sp=pa(Weapon,"1","Block",1,1,1,false,false,0,0,c[1]) weld(sp,hap,sp,0.25+0.125,0,0.075,0,rd(180),rd(90)) qi{"SpecialMesh",sp,MeshType="Wedge",Scale=v3(0.2,0.25,0.15)}
  114. bp=pa(Weapon,"1","Block",2.5,0.3,1,false,false,0,0,c[2]) weld(bp,hap,bp,-0.15,bp.Size.X/2,-0.05,0,0,rd(90)) qi{"SpecialMesh",bp,MeshType="Wedge",Scale=v3(1,1,0.1)}
  115. bp=pa(Weapon,"1","Block",2.5,0.3,1,false,false,0,0,c[2]) weld(bp,hap,bp,0.15,bp.Size.X/2,-0.05,0,0,rd(-90)) qi{"SpecialMesh",bp,MeshType="Wedge",Scale=v3(1,1,0.1)}
  116. bp=pa(Weapon,"1","Block",2.5,0.3,1,false,false,0,0,c[2]) weld(bp,hap,bp,-0.15,bp.Size.X/2,0.05,0,rd(-180),rd(-90)) qi{"SpecialMesh",bp,MeshType="Wedge",Scale=v3(1,1,0.1)}
  117. bp=pa(Weapon,"1","Block",2.5,0.3,1,false,false,0,0,c[2]) weld(bp,hap,bp,0.15,bp.Size.X/2,0.05,0,rd(180),rd(90)) qi{"SpecialMesh",bp,MeshType="Wedge",Scale=v3(1,1,0.1)}
  118. bp=pa(Weapon,"1","Block",1,2,1,false,false,0,0,c[2]) weld(bp,hap,bp,0,2.5,0,0,0,0) qi{"SpecialMesh",bp,MeshId=ids.BladeTip,Scale=v3(0.41,1,0.1375)}
  119.  
  120. ha2=pa(Weapon,"2","Block",1.1,0.4,1.1,false,false,0,0,c[3]) haw2=weld(ha2,LA,ha2,0,-0.2,0,0,0,0)
  121. mshp=pa(Weapon,"2","Block",0.2,1.25,4,false,false,0,0,c[1]) weld(mshp,ha2,mshp,-0.55,0.2,0.25,0,0,0)
  122. h1=pa(Weapon,"2","Block",0,0,0,false,false,1,0) weld(h1,mshp,h1,-0.1,1.25/2,0,0,0,rd(-20))
  123. h2=pa(Weapon,"2","Block",0,0,0,false,false,1,0) weld(h2,mshp,h2,-0.1,-1.25/2,0,0,0,rd(20))
  124. shp=pa(Weapon,"2","Block",0.2,0.75,4,false,false,0,0,c[1]) weld(shp,h1,shp,0.1,0.75/2,0,0,0,0)
  125. shp=pa(Weapon,"2","Block",0.2,0.75,4,false,false,0,0,c[1]) weld(shp,h2,shp,0.1,-0.75/2,0,0,0,0)
  126. for i,v in pairs(Weapon:GetChildren()) do v.CanCollide=false end
  127. end
  128.  
  129. Design({"Really black","Gold","Really black"})
  130. Arms(false)
  131. Legs(false)
  132.  
  133. Dealt={15,24}
  134. Dealt2={30,37}
  135. BBD,BBT=0,{}
  136. BBD2,BBT2=0,{}
  137. CritChance = 15
  138. CriticalSeverity=2.25
  139.  
  140. SwordHit=function(hit)
  141. local Hum=GetHum(hit)
  142. if not Hum or BBD==0 or BBT[Hum.Parent] then return end
  143. BBT[Hum.Parent]=1
  144. if rn(1,100)<=CritChance then
  145. Dmg(Hum,rn(Dealt[1],Dealt[2])*CriticalSeverity,true)
  146. else
  147. Dmg(Hum,rn(Dealt[1],Dealt[2]),false)
  148. end
  149. local HMT=Hum.Parent:findFirstChild'Torso'
  150. if BBD==2 and HMT then AddBV(10,cn(Torso.Position,HMT.Position),HMT,0.15) end
  151. so(ids.Hit,HMT,1,1)
  152. wait(0.4)
  153. BBT[Hum.Parent]=nil
  154. end
  155.  
  156. ShieldHit=function(hit)
  157. local Hum=GetHum(hit)
  158. if not Hum or BBD2==0 or BBT2[Hum.Parent] then return end
  159. BBT2[Hum.Parent]=1
  160. if rn(1,100)<=CritChance/2 then
  161. Dmg(Hum,rn(Dealt2[1],Dealt2[2])*CriticalSeverity,true)
  162. else
  163. Dmg(Hum,rn(Dealt2[1],Dealt2[2]),false)
  164. end
  165. local HMT=Hum.Parent:findFirstChild'Torso'
  166. if BBD2==2 and HMT then
  167. Hum.PlatformStand=true
  168. q(function()
  169. wait(1)
  170. Hum.PlatformStand=false
  171. end)
  172. AddBV(50,cn(Torso.Position,HMT.Position),HMT,0.15)
  173. end
  174. so(ids.ShieldBash,HMT,1,0.35)
  175. wait(0.4)
  176. BBT2[Hum.Parent]=nil
  177. end
  178.  
  179. for i,v in pairs(Weapon:GetChildren()) do if v.Name=="1" then v.Touched:connect(SwordHit) end end
  180. for i,v in pairs(Weapon:GetChildren()) do if v.Name=="2" then v.Touched:connect(ShieldHit) end end
  181.  
  182. function Trail(Loops,Part,Time,Color,Thickness,Offset)
  183. q(function()
  184. local oldpos=(Part.CFrame *Offset).p
  185. local lopz2=0
  186. local function loltr()
  187. local obp=(Part.CFrame *Offset).p
  188. lopz2=lopz2 + 1
  189. local mag=(oldpos - obp).magnitude
  190. local tr=pa(Part,"trail","Block",0,0,0,false,true,0,0,Color)
  191. tr.CanCollide=false
  192. tr.CFrame=cn(oldpos,obp)
  193. tr.CFrame=tr.CFrame + tr.CFrame.lookVector*(mag/2)
  194. local trm=qi{'CylinderMesh',tr,Scale=v3(5*Thickness,mag*5,5*Thickness)}
  195. q(function()
  196. for i=5*Thickness,0,-5*Thickness/10 do
  197. trm.Scale=v3(i,mag*5,i)
  198. w()
  199. end
  200. tr:Remove''
  201. end)
  202. tr.CFrame=tr.CFrame*ca(rd(90),0,0)
  203. oldpos=obp
  204. end
  205. repeat
  206. loltr()
  207. wait(Time)
  208. until lopz2 == Loops
  209. loltr()
  210. end)
  211. end
  212.  
  213. function Stance(speed)
  214. c2(ra,speed,3,1.5,0.5,0,-18,0,-18)
  215. c2(la,speed,3,-1.5,0.5,0,10,0,10)
  216. c2(ll,speed,3,-0.5,-1,0,0,0,0)
  217. c2(rl,speed,3,0.5,-1,0,0,0,0)
  218. c2(hw,speed,3,0,1.5,0,0,0,0)
  219. c2(tw,speed,3,0,0,0,90,180,0)
  220. c2(hw,speed,3,0,1.5,0,0,0,0)
  221. Ani(haw,0,-1,0,-90,90,0,0,speed/1.5,1)
  222. end
  223.  
  224. function Reset(speed)
  225. c2(ra,speed,3,1.5,0.5,0,0,0,0)
  226. c2(la,speed,3,-1.5,0.5,0,0,0,0)
  227. c2(ll,speed,3,-0.5,-1,0,0,0,0)
  228. c2(rl,speed,3,0.5,-1,0,0,0,0)
  229. c2(hw,speed,3,0,1.5,0,0,0,0)
  230. c2(tw,speed,3,0,0,0,90,180,0)
  231. c2(hw,speed,3,0,1.5,0,0,0,0)
  232. Ani(haw,-1,-1,0,0,90,110,0,speed/1.5,1)
  233. end
  234.  
  235. function Combo1()
  236. Combo=0.5
  237. anim="Melee"
  238. c2(ra,0.12,3,1.5,0.7,0,-135,0,60)
  239. c1(hw,0.12,3,0,1.5,0,-25,22.5,0)
  240. anim=""
  241. Combo=1
  242. end
  243.  
  244. function Combo2()
  245. Combo=1.5
  246. anim="Melee"
  247. so(ids.Slash3,bp,1,1)
  248. Trail(8,bp,0,"Gold",0.1,cn(0,0.7,0))
  249. BBD=2
  250. c2(ra,0.25,3,0.5,0.2,-0.5,0,-45+22.5,30)
  251. c1(hw,0.25,3,0,1.5,0,10,-30,0)
  252. BBD=0
  253. anim=""
  254. Combo=2
  255. end
  256.  
  257. function Combo3()
  258. Combo=2.5
  259. anim="Melee"
  260. c2(hw,0.12,3,0,1.5,0,0,-50,0)
  261. c2(ra,0.12,3,1,0.5,-0.5,-120,0,-90)
  262. c1(la,0.12,3,-1.5,0.5,0,45,0,45)
  263. anim=""
  264. Combo=3
  265. end
  266.  
  267. function Combo4()
  268. Combo=3.5
  269. anim="Melee"
  270. so(ids.Slash3,bp,1,1)
  271. Trail(8,bp,0,"Gold",0.1,cn(0,0.7,0))
  272. BBD=2
  273. c2(hw,0.25,3,0,1.5,0,0,60,0)
  274. c1(ra,0.25,3,1.25,0.5,0.3,35,0,-90)
  275. BBD=0
  276. anim=""
  277. Combo=4
  278. end
  279.  
  280. function Combo5()
  281. Combo=4.5
  282. anim="Melee"
  283. c2(tw,0.12,3,0,0,0,90,180,15)
  284. c2(la,0.12,3,-0.5,0.5,-1,-90,90-15,0)
  285. c2(hw,0.12,3,0,1.5,0,0,-15,0)
  286. c1(ra,0.12,3,1.5,0.5,0,35,0,-35)
  287. Block.Value=4
  288. anim=""
  289. Combo=5
  290. end
  291.  
  292. function Combo6()
  293. Combo=5.5
  294. anim="Melee"
  295. c2(la,0.12,3,-0.45,0.5,-0.9,-90,100-15,0)
  296. c2(tw,0.12,3,0,0,0,90,180,25)
  297. c1(hw,0.12,3,0,1.5,0,0,-20,0)
  298. anim=""
  299. Combo=6
  300. end
  301.  
  302. function Combo7()
  303. Combo=6.5
  304. anim="Melee"
  305. so(ids.Slash,mshp,1,0.5)
  306. BBD2=2
  307. Trail(8,mshp,0,"Gold",1.5,cn(0,0,0))
  308. Block.Value=0
  309. c2(la,0.25,3,-1.25,0.5,0.25,-90,-120,0)
  310. c2(tw,0.25,3,0,0,0,90,180,-50)
  311. c1(hw,0.25,3,0,1.5,0,0,-35,0)
  312. BBD2=0
  313. Combo=7
  314. anim=""
  315. end
  316.  
  317. function Break()
  318. Combo=-0.5
  319. Block.Value=0
  320. Stance(0.1)
  321. anim=""
  322. Combo=0
  323. end
  324.  
  325. function Button1Down()
  326. if equip=="equipped" and anim=="" then
  327. if Combo==0 then
  328. Combo1()
  329. q(function()
  330. wait(1)
  331. if Combo==1 then
  332. Break()
  333. end
  334. end)
  335. elseif Combo==1 then
  336. Combo2()
  337. q(function()
  338. wait(1)
  339. if Combo==2 then
  340. Break()
  341. end
  342. end)
  343. elseif Combo==2 then
  344. Combo3()
  345. q(function()
  346. wait(1)
  347. if Combo==3 then
  348. Break()
  349. end
  350. end)
  351. elseif Combo==3 then
  352. Combo4()
  353. q(function()
  354. wait(1)
  355. if Combo==4 then
  356. Break()
  357. end
  358. end)
  359. elseif Combo==4 then
  360. Combo5()
  361. q(function()
  362. wait(1)
  363. if Combo==5 then
  364. Break()
  365. end
  366. end)
  367. elseif Combo==5 then
  368. Combo6()
  369. q(function()
  370. wait(1)
  371. if Combo==6 then
  372. Break()
  373. end
  374. end)
  375. elseif Combo==6 then
  376. Combo7()
  377. q(function()
  378. wait(1)
  379. if Combo==7 then
  380. Break()
  381. end
  382. end)
  383. end
  384. end
  385. if equip=="equipped" and anim=="Block" and keys["f"]==true then
  386. anim="ShieldBash"
  387. c2(la,0.12,3,-0.45,0.5,-0.9,-90,100,0)
  388. c2(tw,0.12,3,0,0,0,90,180,15)
  389. c1(hw,0.12,3,0,1.5,0,0,5,0)
  390. so(ids.Slash,mshp,1,0.5)
  391. wait(0.2)
  392. Hum.WalkSpeed=16
  393. BBD2=2
  394. Trail(8,mshp,0,"Gold",1.5,cn(0,0,0))
  395. Block.Value=0
  396. c2(la,0.25,3,-1.25,0.5,0.25,-90,-120,0)
  397. c2(tw,0.25,3,0,0,0,90,180,-50)
  398. c1(hw,0.25,3,0,1.5,0,0,-35,0)
  399. BBD2=0
  400. wait(0.4)
  401. Stance(0.1)
  402. anim=""
  403. end
  404. end
  405.  
  406. function KeyDown(key)
  407. key=key:lower()
  408. keys[key]=true
  409. if key == "f" then
  410. if anim=="" and equip=="equipped" and Combo==0 then
  411. anim="Blocking" Block.Value=4 Hum.WalkSpeed=8
  412. c2(la,0.12,3,-0.5,0.5,-1,-90,90,0)
  413. c1(ra,0.12,3,1.5,0.5,0,35,0,-35)
  414. anim="Block"
  415. repeat wait() until Block.Value<=0
  416. if anim=="Block" then
  417. Block.Value=0
  418. anim="Unblocking"
  419. Hum.WalkSpeed=16
  420. Stance(0.05)
  421. anim=""
  422. end
  423. end
  424. end
  425. end
  426.  
  427. function KeyUp(key)
  428. key=key:lower()
  429. keys[key]=false
  430. if key=="f" and equip=="equipped" and anim=="Block" then
  431. anim="Unblocking"
  432. Block.Value=0
  433. Hum.WalkSpeed=16
  434. Stance(0.2)
  435. anim=""
  436. end
  437. end
  438.  
  439. Tool.Selected:connect(function(m)
  440. fmouse=m
  441. if equip=="unequipped" and anim=="" and Combo==0 then
  442. anim="equipping"
  443. Arms(true)
  444. c2(hw,0.1,3,0,1.5,0,15,-15,0)
  445. c1(ra,0.1,3,1.5/3,0.5/3,-0.7,0,-180,60)
  446. c2(ra,0.1,3,1.5/3,0.5/3,-0.7,60,-180,60)
  447. Ani(haw,-1,-0.25,-2.5,0,90,110,0,0.05,1)
  448. local ofs = RA.CFrame:toObjectSpace(ha.CFrame)
  449. haw.Part0=RA haw.C0=ofs haw.C1=cn(0,0,0) rAni(haw)
  450. Stance(0.1)
  451. anim=""
  452. equip="equipped"
  453. end
  454. m.Button1Down:connect(Button1Down)
  455. m.KeyDown:connect(KeyDown)
  456. m.KeyUp:connect(KeyUp)
  457. end)
  458.  
  459. Tool.Deselected:connect(function()
  460. fmouse=nil
  461. if equip=="equipped" and anim=="" and Combo==0 then
  462. anim="unequipping"
  463. c2(hw,0.1,3,0,1.5,0,15,-15,0)
  464. c1(ra,0.1,3,1.5/3,0.5/3,-0.7,60,-180,60)
  465. c2(ra,0.1,3,1.5/3,0.5/3,-0.7,0,-180,60)
  466. local ofs = Torso.CFrame:toObjectSpace(ha.CFrame)
  467. haw.Part0=Torso haw.C0=ofs haw.C1=cn(0,0,0) rAni(haw)
  468. Reset(0.1)
  469. Arms(false)
  470. Legs(false)
  471. anim=""
  472. equip="unequipped"
  473. end
  474. end)
  475.  
  476. Gyro=qi{"BodyGyro",fTorso,D=50,P=1500}
  477. game:GetService("RunService").Stepped:connect(function()
  478. if fmouse ~= nil then
  479. Gyro.maxTorque=v3(1/0,1/0,1/0)
  480. Gyro.cframe = cn(fTorso.Position,v3(Cam.CoordinateFrame.p.x,fTorso.Position.y,Cam.CoordinateFrame.p.z))*ca(0,rd(180),0)
  481. else
  482. Gyro.maxTorque = v3(0,0,0)
  483. end
  484. end)
  485.  
  486. Hum.Running:connect(function(spd)
  487. if spd>0 then
  488. running=true
  489. else
  490. running=false
  491. end
  492. end)
  493. wait()
  494.  
  495. local player = game.Players.LocalPlayer
  496. local m = player:GetMouse()
  497.  
  498. local runService = game:GetService("RunService")
  499.  
  500. local dp = Vector3.new()
  501. local dcf = CFrame.new()
  502.  
  503. local shrink
  504. local magiccam = true
  505. local camconnect
  506.  
  507. local oldPos = Vector3.new()
  508. local oldx = Vector3.new()
  509. local oldy = Vector3.new()
  510. local oldz = Vector3.new()
  511.  
  512. local helpergui = Instance.new("ScreenGui", player.PlayerGui)
  513. local camRot = Vector2.new()
  514. local camDist = 10
  515.  
  516. function camera()
  517. if magiccam then
  518. local ax = CFrame.Angles(camRot.x, 0, 0)
  519. local ay = CFrame.Angles(0, camRot.y, 0)
  520. local a = CFrame.Angles(-(m.Y / helpergui.AbsoluteSize.y-0.5), -(m.X / helpergui.AbsoluteSize.x-0.5), 0) * ay * ax
  521. local sx, sy, sz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = (player.Character.Head.CFrame * a):components()
  522. local x = Vector3.new(m00, m10, m20)
  523. local y = Vector3.new(m01, m11, m21)
  524. local z = Vector3.new(m02, m12, m22)
  525. local p = Vector3.new(sx, sy, sz)
  526. local lv = (player.Character.Head.CFrame * ay * ax).lookVector
  527. p = p - lv * camDist
  528. p = p:Lerp(oldPos, 0.8)
  529. x = x:Lerp(oldx, 0.8)
  530. y = y:Lerp(oldy, 0.8)
  531. z = z:Lerp(oldz, 0.8)
  532. x = x / x.magnitude
  533. y = y / y.magnitude
  534. z = z / z.magnitude
  535. oldx = x
  536. oldy = y
  537. oldz = z
  538. oldPos = p
  539. game.Workspace.CurrentCamera.CoordinateFrame = CFrame.new(p.x, p.y, p.z, x.x, y.x, z.x,
  540. x.y, y.y, z.y,
  541. x.z, y.z, z.z)
  542. end
  543. end
  544.  
  545. local mPos = Vector2.new()
  546. local mb2d = false
  547. m.Button2Down:connect(function ()
  548. mb2d = true
  549. mPos = Vector2.new(m.X, m.Y)
  550. while mb2d do
  551. camRot = Vector2.new(-((m.Y-mPos.y) / helpergui.AbsoluteSize.y) * math.pi * 1.5, -((m.X-mPos.x) / helpergui.AbsoluteSize.x) * math.pi * 2)
  552. wait()
  553. end
  554. end)
  555.  
  556. m.Button2Up:connect(function ()
  557. camRot = Vector2.new()
  558. mb2d = false
  559. end)
  560.  
  561. --[[m.WheelForward:connect(function ()
  562. camDist = math.max(camDist - 1, 3)
  563. end)
  564.  
  565. m.WheelBackward:connect(function ()
  566. camDist = math.min(camDist + 1, 50)
  567. end)
  568.  
  569. player.Character.Humanoid.Died:connect(function ()
  570. magiccam = false
  571. game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
  572. end)
  573.  
  574. runService.RenderStepped:connect(camera)
  575.  
  576. game.Workspace.CurrentCamera.CameraType = "Scriptable"]]
Add Comment
Please, Sign In to add comment