Project_MAtrix_ZERGO

W%NA%NA%

Jun 21st, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 27.06 KB | None | 0 0
  1.  
  2.  
  3. Robot = {}
  4. Robot.Name = "EvilMachine"
  5. Robot.Health=100
  6. Robot.Scale=1
  7. Robot.Color = "Really black"
  8. Robot.Color2 = "Really red"
  9. --declarations
  10. PI=math.pi
  11. TAU=PI*2
  12. DEBRIS=game:service'Debris'
  13. mr,md=math.random,math.rad
  14. cfn,v3n=CFrame.new,Vector3.new
  15. _A=nil
  16. ang=function(x,y,z)local a=CFrame.Angles(x or 0,y or 0,z or 0)_A=a return a end
  17. RS=game:service'RunService'
  18. bcol=BrickColor.new
  19. RS:UnbindFromRenderStep('Anim')
  20. --player specific...
  21. player = game.Players.LocalPlayer
  22. character = player.Character
  23. torso = character.Torso
  24. head = character.Head
  25. rarm = character['Right Arm']
  26. larm = character['Left Arm']
  27. rleg = character['Right Leg']
  28. rleg = character['Left Leg']
  29. human = character.Humanoid
  30. --Utilities... who needs them?
  31. function findHum(pos,rad,hum2)
  32. local hums={}
  33. function check(a)
  34. local res=false
  35. for i,ho in pairs(hums)do
  36. if a==ho then res=true end
  37. end
  38. return res
  39. end
  40. for i,v in pairs(Workspace:children())do
  41. if v:IsA'Model'and v~=Char and v~=(hum2 or Char) then
  42. for i,q in pairs(v:children())do
  43. if q:IsA'Humanoid' and q.Parent:FindFirstChild'Torso'and(q.Torso.Position-pos).magnitude < rad then
  44. if not check(q)then
  45. table.insert(hums,q)
  46. end
  47. end
  48. end
  49. end
  50. end
  51. return hums
  52. end
  53. function checkY(p1,p2,range,range2)
  54. local function checko()
  55. return ( (l(p1).X>l(p2).X-range2 and l(p1).X<l(p2).X+range2) and (l(p1).Z>l(p2).Z-range2 and l(p1).Z<l(p2).Z+range2) )
  56. end
  57. if range2 then
  58. return (l(p1).Y > l(p2).Y-range and l(p2).Y < l(p2).Y+range) and checko()
  59. else
  60. return (l(p1).Y > l(p2).Y-range and l(p2).Y < l(p2).Y+range)
  61. end
  62. end
  63. udim=function(a,b,c,d)
  64. if type(a)=='string'then
  65. x,y=tostring(a):match('([%+%d%.%-%/%*]+),([%+%d%.%-%/%*]+)')
  66. return UDim2.new(x or 0,x2 or 0,y or 0,y2 or 0)
  67. else
  68. return UDim2.new(a or 0,c or 0,b or 0,d or 0)
  69. end end
  70. function l(a1,x,y,z,rx,ry,rz)
  71. local cf
  72. if tostring(a1):find(',') == nil then
  73. cf=a1.CFrame
  74. else cf=a1 end
  75. return cf*CFrame.new(x or 0,y or 0,z or 0)*CFrame.Angles(
  76. rx or 0,ry or 0,yz or 0)
  77. end
  78. function f(a) --turns thigns in to function returning the thing... f(l)(torso,0,2,0)
  79. return function(...)
  80. local args={...}
  81. return function() return a(unpack(args)) end
  82. end
  83. end
  84. function isIn(what,tab) --returns true if what is in tab. isIn("Troll", {"Tomato", "Troll", "Strawberry") --> true
  85. local res=false
  86. for i,v in next,tab do
  87. if v==what then
  88. res = true
  89. break
  90. end
  91. end
  92. return res
  93. end
  94. Weld = function(part0,part1,c0,c1,...) --over-engineered welding function which accepts many things
  95. local ar = {...}
  96. local cframe0,cframe1
  97. local function checkf()local res=true
  98. for i,v in pairs(ar)do
  99. if type(v) ~= 'number' then
  100. res=false
  101. end
  102. end
  103. return res
  104. end
  105. if type(c0) == 'table' then
  106. cframe0 = CFrame.new(c0[1] or 0, c0[2] or 0, c0[3] or 0) * CFrame.Angles(
  107. c0[4] or 0, c0[5] or 0, c0[6] or 0)
  108. elseif type(c0) == 'userdata' then
  109. cframe0 = c0
  110. elseif type(c0) == 'number' and checkf() then
  111. cframe0 = CFrame.new(c0 or 0,c1 or 0,ar[1] or 0) * CFrame.Angles(ar[2] or 0, ar[3] or 0, ar[4] or 0)
  112. end
  113. if type(c1) == 'table' then
  114. cframe1 = CFrame.new(c1[1] or 0, c1[2] or 0, c1[3] or 0) * CFrame.Angles(
  115. c1[4] or 0, c1[5] or 0, c1[6] or 0)
  116. elseif type(c1) == 'userdata' then
  117. cframe1 = c1
  118. elseif type(c1) == 'number' and (not c0 or (c0 and type(c0) == 'table')) then
  119. cframe1 = CFrame.new(c1 or 0, ar[1] or 0, ar[2] or 0) * CFrame.Angles(ar[3] or 0, ar[4] or 0, ar[5] or 0)
  120. end
  121. for i,v in pairs(ar)do
  122. if type(v) == 'table' then
  123. cframe1 = CFrame.new(v[1] or 0, v[2] or 0, v[3] or 0) * CFrame.new(v[4] or 0, v[5] or 0, v[6] or 0)
  124. elseif type(v) == 'userdata' then
  125. cframe1 = v
  126. end
  127. end
  128.  
  129. cframe0,cframe1 = cframe1,cframe0
  130. part0.Position=part1.Position
  131. local weld = Instance.new("Weld")
  132. weld.Part0 = part0
  133. weld.Part1 = part1
  134. weld.C0 = cframe0 or CFrame.new()
  135. weld.C1 = cframe1 or CFrame.new()
  136. if weld:IsA'Motor'then weld.MaxVelocity = set_maxvel or .1 end
  137. weld.Parent = part0
  138. _2=weld
  139. return weld
  140. end
  141. mesh_ids = {
  142. spikeball = "rbxassetid://0";
  143. spike = "rbxassetid://0";
  144. ring = "rbxassetid://0";
  145. coil = 'rbxassetid://0';
  146. diamond = 'rbxassetid://0';
  147. rock = 'rbxassetid://0';
  148. gear = 'rbxassetid://0';
  149. crown = 'rbxassetid://0';
  150. orb = 'rbxassetid://0';
  151. heart = 'rbxassetid://0';
  152. dragon = 'rbxassetid://0';
  153. }
  154. mesh_texs = {
  155. rock = 'rbxassetid://1290030';
  156. dragon = 'rbxassetid://25665033';
  157. }
  158. mesh_scales={
  159. diamond = v3n(0.75, 0.75, 0.75);
  160. spikeball = v3n(1.05, 1.05, 1.05);
  161. spike = v3n(0.5, 1.5, 0.5);
  162. gear = v3n(1.25,1.25,18);
  163. ring = v3n(1, 1, 6);
  164. coil = v3n(0.5, 0.5, 0.3);
  165. crown = v3n(0.6, 0.6, 0.6);
  166. orb = v3n(1, 1, 1);
  167. heart = v3n(0.25, 0.25, 0.4);
  168. dragon = v3n(0.4, 0.5, 0.4);
  169. }
  170. mesh_offsets={
  171. crown = v3n(0,.15,0);
  172. }
  173. function bindMesh(mesh,Size)
  174. local mesh_name
  175. local size=Size or mesh.Parent.Size
  176. for name,id in next,mesh_ids do
  177. if mesh.MeshId==id then
  178. mesh_name=name
  179. end
  180. end
  181. if not mesh_name then return end
  182. local mesh=mesh
  183. local con
  184. con=mesh.Parent.Changed:connect(function()
  185. local siz=mesh.Parent.Size
  186. mesh.Scale=siz*mesh_scales[mesh_name]
  187. if mesh_offsets[mesh_name] then
  188. mesh.Offset=siz*mesh_offsets[mesh_name]
  189. end
  190. end)
  191. return con
  192. end
  193. Mesh = function(parent,id,sx,sy,sz)
  194. local name = ( (id == 'cyl' and 'CylinderMesh') or (id == 'bl' and 'BlockMesh') or 'SpecialMesh')
  195. local mesh = Instance.new(name)
  196. if id == 's' then
  197. mesh.MeshType = Enum.MeshType.Sphere
  198. elseif id == 'w' then
  199. mesh.MeshType = Enum.MeshType.Wedge
  200. elseif id == 'h' then
  201. mesh.MeshType = Enum.MeshType.Head
  202. elseif string.find(id,"://") ~= nil then
  203. mesh.MeshId = id
  204. end
  205. mesh.Scale = Vector3.new(sx or 1, sy or 1, sz or 1)
  206. mesh.Parent = parent
  207. _3=mesh
  208. return mesh
  209. end
  210. Edit = function(what)
  211. return function(args)
  212. for ind,obj in next,what do
  213. for arg,val in next,args do
  214. local child,argu = arg:match"(.+)%.(.+)"
  215. if child and argu then
  216. if pcall(function()return obj[child][argu] end) then
  217. obj[child][argu]=val
  218. end
  219. else
  220. if arg=='_F'then
  221. val(ind,obj)
  222. elseif pcall(function()return obj[arg]end) then
  223. obj[arg]=val
  224. end
  225. end
  226. end
  227. end
  228. end
  229. end
  230. New = function(what) --Synthetic caffeine for Instance.new
  231. local obj
  232. if type(what) ~= 'string' then
  233. obj=what:Clone()
  234. else
  235. obj=Instance.new(what)
  236. end
  237. if what=='Weld' then obj.Name='mujoint'end
  238. return function(bar)
  239. for arg,val in pairs(bar) do
  240. if arg == "_P" then
  241. obj.Parent = val
  242. elseif arg=="_PP" then
  243. obj.Part0=val[1]
  244. obj.Part1=val[2]
  245. elseif arg=='_F'then
  246. val(obj)
  247. else
  248. if pcall(function()return obj[arg] end) then
  249. obj[arg]=val
  250. end
  251. end
  252. end _4=obj
  253. return obj
  254. end
  255. end
  256. set_parent,set_material=nil,nil
  257. set_maxvel,set_anchor=nil,nil
  258. _1,_2,_3,_4,_5,_6,_7,_8 = nil,nil,nil,nil,nil,nil,nil
  259. Part = function(x,y,z,col,tr)
  260. local p = New"Part"{
  261. _P=set_parent or ears or Main;
  262. BrickColor = BrickColor.new(col or set_color or "Really black");
  263. CanCollide = false;
  264. Transparency = tr or 0;
  265. Size = Vector3.new(x or 0,y or 0,z or 0);
  266. Material = set_material or 'SmoothPlastic';
  267. Anchored = (set_anchor~=nil and set_anchor or false)
  268. }
  269. for _,sur in next,Enum.NormalId:GetEnumItems() do
  270. p[sur.Name..'Surface'] = 10
  271. end
  272. _1 = p
  273. return p
  274. end
  275. Joints={}
  276. Joint={}
  277. Joint.new=function(name,weld,c0,c1)
  278. local joint={
  279. w=weld;
  280. part1=weld.Part1;
  281. n_c0=(c0 or weld.C0);
  282. n_c1=(c1 or weld.C1);
  283. name=name;
  284. previous=weld.C0;
  285. _can_kf=true;
  286. }
  287. joint.keys={};
  288. function joint:revertToOrig()
  289. self.w.C0=self.n_c0
  290. self.w.C1=self.n_c1
  291. end
  292. function joint:NewAnim(anim)
  293. self.keys[anim]={}
  294. end
  295. setmetatable(joint,{
  296. __mul=function(ta,val)
  297. return ta.n_c0*val
  298. end;
  299. })
  300. getfenv()[name]=joint
  301. Joints[name]=joint
  302. return joint
  303. end
  304. pcall(function() character[Robot.Name]:Destroy() end) --removes old model.
  305. pcall(function()character.Head.face.Transparency=1 end)
  306. Main = New"Model"{_P=character;Name = Robot.Name}
  307. for i,v in pairs(character:children())do
  308. if v:IsA'Hat'then v.Handle.Transparency=1
  309. elseif v:IsA'Part'then
  310. v.Transparency=1 end
  311. end
  312. --Torso...
  313. midp=Part(4,1.5,2)_1.Transparency=1
  314. Weld(midp,torso)
  315. bottomp=Part(2,1.5,1.5,_,1)
  316. Joint.new('b_p',Weld(bottomp,midp,0,-.75))
  317. --Cage--
  318. back_wall=Part(2,1.5,.25)
  319. Weld(_1,bottomp,0,0,.75-.125)
  320. front_wall=Part(2,1.25,.25)
  321. -- Weld(_1,bottomp,0,0,-.75-.125)
  322. cabin_mot=New"Motor"{_P=front_wall;_PP={front_wall,bottomp};
  323. C1=cfn(0,.75,-.75+.125)*ang(0,PI/2);C0=cfn(0,1.25/2,0)*ang(0,PI/2);
  324. MaxVelocity=.1}
  325. -- Spawn(function() --demonstration of secret cabinet
  326. -- while wait(1)do
  327. -- cabin_mot.DesiredAngle=PI/2
  328. -- wait(1)
  329. -- cabin_mot.DesiredAngle=0
  330. -- end end)
  331. bottom_wall=Part(2,.25,1.5)
  332. Weld(bottom_wall,bottomp,0,-.75+.125)
  333. --Sides
  334. p=Part(1.5,1.5,.75)Mesh(p,'w')
  335. Weld(p,bottomp,-1-.75/2,0,0,PI,PI/2)
  336. p=Part(1.5,1.5,.75)Mesh(p,'w')
  337. Weld(p,bottomp,1+.75/2,0,0,PI,-PI/2)
  338. topp=Part(4,1.5,2)
  339. -- Weld(topp,bottomp,0,1.5)
  340. Joint.new('t_p',New"Weld"{_P=topp;_PP={topp,bottomp};C1=cfn(0,.75,0);C0=cfn(0,-.75,0)})
  341. --head
  342. hed=Part(1,1,1)
  343. Weld(hed,topp,0,.75+.5)
  344. for _,v in pairs{ {.55,0};{-.55,PI} } do
  345. local p=Part(.35,.1,.35)Mesh(_1,'cyl')
  346. Weld(_1,hed,v[1],.235,0,0,v[2],PI/2)
  347. local p2=Part(.35,.1,.35)Mesh(p2,'s')
  348. Weld(p2,p,0,-.05)
  349. local cyl=Part(.1,.25,.1)
  350. Mesh(_1,'cyl',.5,1,.5)
  351. Weld(cyl,p,.35/2+(.25/2-.05),-.025,0,PI/2,0,PI/2)
  352. local cyl2=Part(.1,.25,.1)
  353. Mesh(_1,'cyl',.25,1/2,.25)
  354. Weld(cyl2,cyl,0,-.125-(.125/2))
  355. local cyl3=Part(.1,.25,.1)
  356. Mesh(_1,'cyl',.125,1/2,.125)
  357. Weld(cyl3,cyl2,0,-.25/2)
  358. end
  359. --Faces--
  360. faces={}
  361. faces.happy="[[2, 1], [7, 1], [2, 2], [7, 2], [2, 3], [7, 3], [1, 6], [8, 6], [1, 7], [2, 7], [7, 7], [8, 7], [2, 8], [3, 8], [4, 8], [5, 8], [6, 8], [7, 8]]"
  362. faces.sad="[[2, 1], [7, 1], [2, 2], [7, 2], [2, 3], [7, 3], [2, 6], [3, 6], [4, 6], [5, 6], [6, 6], [7, 6], [1, 7], [2, 7], [7, 7], [8, 7], [1, 8], [8, 8]]"
  363. faces.xD="[[1, 1], [2, 1], [7, 1], [8, 1], [2, 2], [3, 2], [4, 2], [6, 2], [7, 2], [4, 3], [5, 3], [6, 3], [3, 4], [4, 4], [6, 4], [7, 4], [2, 5], [3, 5], [7, 5], [8, 5], [1, 7], [2, 7], [3, 7], [4, 7], [5, 7], [6, 7], [7, 7], [8, 7], [1, 8], [8, 8], [2, 9], [3, 9], [4, 9], [5, 9], [6, 9], [7, 9]]"
  364. faces.angry="[[2, 1], [7, 1], [2, 2], [3, 2], [6, 2], [7, 2], [3, 3], [7, 3], [2, 4], [3, 4], [6, 4], [7, 4], [2, 8], [3, 8], [4, 8], [5, 8], [6, 8], [7, 8]]"
  365. faces.bored="[[1, 1], [2, 1], [3, 1], [6, 1], [7, 1], [8, 1], [2, 2], [7, 2], [2, 3], [7, 3], [2, 4], [7, 4], [2, 7], [3, 7], [4, 7], [5, 7], [6, 7], [7, 7], [1, 8], [2, 8], [7, 8], [8, 8]]"
  366. faces.normal="[[2, 1], [7, 1], [2, 2], [7, 2], [2, 3], [7, 3], [2, 8], [3, 8], [4, 8], [5, 8], [6, 8], [7, 8]]"
  367. faces.heart="[[2, 1], [7, 1], [1, 2], [2, 2], [3, 2], [6, 2], [7, 2], [8, 2], [0, 3], [1, 3], [2, 3], [3, 3], [4, 3], [5, 3], [6, 3], [7, 3], [8, 3], [9, 3], [0, 4], [1, 4], [2, 4], [3, 4], [4, 4], [5, 4], [6, 4], [7, 4], [8, 4], [9, 4], [1, 5], [2, 5], [3, 5], [4, 5], [5, 5], [6, 5], [7, 5], [8, 5], [2, 6], [3, 6], [4, 6], [5, 6], [6, 6], [7, 6], [3, 7], [4, 7], [5, 7], [6, 7], [4, 8], [5, 8]]"
  368. htp=game:service'HttpService'
  369. bitmap=htp:JSONDecode(faces.normal)
  370. surfg=New"SurfaceGui"{_P=hed;Face='Front';Size=udim'1,1'}
  371. fr=New"Frame"{_P=surfg;Size=udim'1,1';BackgroundTransparency=1}
  372. for y=1,10 do
  373. for x=1,10 do
  374. local f=New"Frame"{_P=fr;Size=udim(1/10,1/10);Position=udim( (-1+x)*1/10,(-1+y)*1/10 );
  375. BackgroundColor=bcol(Robot.Color2);BackgroundTransparency=1;
  376. }
  377. for _,v in pairs(bitmap) do
  378. if v[1] and v[2] then
  379. if x-1==v[1] and y-1==v[2] then
  380. f.BackgroundTransparency=0
  381. end
  382. end
  383. end
  384. -- if bitmap[y][x] ~= nil and bitmap[y][x]==1 then
  385. -- f.BackgroundTransparency=0
  386. -- end
  387. end
  388. end
  389. function changeFace(face)
  390. local bitmap=htp:JSONDecode(faces[face])
  391. fr:ClearAllChildren()
  392. for y=1,10 do
  393. for x=1,10 do
  394. -- print(x,y)
  395. f=New"Frame"{_P=fr;Size=udim(1/10,1/10);Position=udim( (-1+x)*1/10,(-1+y)*1/10 );
  396. BackgroundColor=bcol(Robot.Color2);BackgroundTransparency=1;
  397. }
  398. for _,v in pairs(bitmap) do
  399. if v[1] and v[2] then
  400. if x-1==v[1] and y-1==v[2] then
  401. f.BackgroundTransparency=0
  402. end
  403. end
  404. end
  405. end
  406. end
  407. prevface=faces[face]
  408. end
  409. ----
  410. --Health display
  411. function newseg(le,x,y,z,rx,ry,rz)
  412. local segment={}
  413. segment.modl=New"Model"{_P=Main;Name='Segment'}
  414. set_parent=segment.modl
  415. le=le or .5
  416. local p=Part(le,.1,.1,'Really red')Mesh(p,'bl',1,.5,.1)
  417. Weld(p,bgp,x,y,z,rx,ry,rz)
  418. local p2=Part(.1,.1,.1,'Really red')Mesh(p2,'bl',.35,.35,.1)
  419. Weld(p2,p,le/2,0,0,0,0,PI/4)
  420. local p22=Part(.1,.1,.1,'Really red')Mesh(p22,'bl',.35,.35,.1)
  421. Weld(p22,p,-le/2,0,0,0,0,PI/4)
  422.  
  423. Edit{p,p2,p22}{Material='Neon';Transparency=1}
  424.  
  425. function segment:light(a)
  426. for i,v in pairs(self.modl:children())do
  427. v.BrickColor=bcol'Really red'
  428. v.Material='Neon'
  429. v.Transparency=a or 0
  430. end
  431. end
  432.  
  433. function segment:dim(a)
  434. for i,v in pairs(self.modl:children())do
  435. v.BrickColor=bcol'Hurricane rgey'
  436. v.Material='SmoothPlastic'
  437. v.Transparency=.9
  438. end
  439. end
  440. set_parent=nil
  441.  
  442. return segment
  443. end
  444. letters = {
  445. [0]='1111110';[1]='0110000';[2]='1101101';[3]='1111001';[4]='0110011';[5]='1011011';
  446. [6]='1011111';[7]='1110000';[8]='1111111';[9]='1111011';
  447. ['A']='1110111';['b']='0011111';['C']='1001110';['d']='0111101';['E']='1001111';['F']='1000111'
  448. }
  449. function new7Dig(x,y,z,rx,ry,rz)
  450. local disp = {}
  451. disp.segs={}
  452.  
  453. bgp=Part(.75,1,.1,'Black')
  454. Weld(bgp,topp,x,y,z,rx,ry,rz)
  455.  
  456. disp.segs[1]=newseg(_,0,.4,-.1) --top
  457. disp.segs[6]=newseg(.25,.75*.4,.2,-.1,0,0,PI/2) --second top
  458. disp.segs[2]=newseg(.25,-.75*.4,.2,-.1,0,0,PI/2)
  459.  
  460. disp.segs[7]=newseg(_,0,0,-.1) --middle
  461. disp.segs[5]=newseg(.25,.75*.4,-.2,-.1,0,0,PI/2) --second bottom
  462. disp.segs[3]=newseg(.25,-.75*.4,-.2,-.1,0,0,PI/2)
  463.  
  464. disp.segs[4]=newseg(_,0,-.4,-.1) --bottom
  465.  
  466. function disp:show(letter)
  467. for i,v in pairs(disp.segs)do
  468. v:dim()
  469. end
  470. local str=letters[tonumber(letter)]
  471. for i=1,7 do
  472. -- print(i)
  473. local s=str:sub(i,i)
  474. if s=='1' then
  475. self.segs[i]:light()
  476. end
  477. end
  478. end
  479. return disp
  480. end
  481. D2=new7Dig(0,0,-1.05)
  482. D=new7Dig(.75,0,-1.05)
  483. D3=new7Dig(-.75,0,-1.05)
  484. local prevhp=99
  485. prevface=faces.normal
  486. human.HealthChanged:connect(function(hp)
  487. local str=tostring(math.floor(hp))
  488. if #str==3 then
  489. D:show(str:sub(1,1))
  490. D2:show(str:sub(2,2))
  491. D3:show(str:sub(3,3))
  492. elseif #str==2 then
  493. D:show(0)
  494. D2:show(str:sub(1,1))
  495. D3:show(str:sub(2,2))
  496. elseif #str==1 then
  497. D:show(0)
  498. D2:show(0)
  499. D3:show(str:sub(1,1))
  500. end
  501. end)
  502. human.Health=99
  503. ----
  504. --Right arm...
  505. s=Part(1.25,1.25,1.25)
  506. Joint.new('s_r',New"Motor"{_P=s;_PP={s,topp};C1=cfn(3-.625,.75,0)*ang(0,PI)})
  507. a1=Part(1,1.5,1)
  508. Joint.new('e_r',New"Motor"{_P=a1;_PP={a1,s};C1=cfn(0,-1.25/2,0);C0=cfn(0,.75,0)})
  509. a2=Part(1,1.5,1,_,.5)
  510. Joint.new('a_r',New"Motor"{_P=a1;_PP={a2,a1};C1=cfn(0,-.75,0);C0=cfn(0,.75,0)})
  511. --Another secret cabinet
  512. cabin_mot.DesiredAngle=PI/2
  513. front_wall=Part(1,1.4,.1)
  514. Weld(_1,a2,0,-.05,.5-.1)
  515. back_wall=Part(1,1.4,.1)
  516. Weld(_1,a2,0,-.05,-.5+.1)
  517. top_wall=Part(1,.1,1,'Black')
  518. Weld(top_wall,a2,0,.75-.05)
  519. local hand_r=Part(1.1,.75,.5)
  520. Joint.new('h_r',New"Motor"{_P=hand_r;_PP={hand_r,a2};C1=cfn(0,-.75,0);C0=cfn(0,.75/2,0)})
  521. local heart_r=Part(.5,.5,.1,Robot.Color2)
  522. Weld(_1,hand_r,0,0,-.25)
  523. --Left arm...
  524. s=Part(1.25,1.25,1.25)
  525. Joint.new('s_l',New"Motor"{_P=s;_PP={s,topp};C1=cfn(-(3-.625),.75,0)*ang(0,PI)})
  526. a1=Part(1,1.5,1)
  527. Joint.new('e_l',New"Motor"{_P=a1;_PP={a1,s};C1=cfn(0,-1.25/2,0);C0=cfn(0,.75,0)})
  528. a2=Part(1,1.5,1)
  529. Joint.new('a_l',New"Motor"{_P=a1;_PP={a2,a1};C1=cfn(0,-.75,0);C0=cfn(0,.75,0)})
  530. hand_l=Part(1.1,.75,.5)
  531. Joint.new('h_l',New"Motor"{_P=hand_l;_PP={hand_l,a2};C1=cfn(0,-.75,0);C0=cfn(0,.75/2,0)})
  532. heart_l=Part(.5,.5,.1,Robot.Color2)
  533. Weld(_1,hand_l,0,0,-.25)
  534. human.HipHeight=3
  535. hole=Part(1.25*.8,.1,1.25*.8,'Black')
  536. local partata = New"ParticleEmitter"{_P=hole;}
  537. partata.Size = NumberSequence.new(30,2,1)
  538. partata.Speed = NumberRange.new (-4)
  539. partata.Lifetime = NumberRange.new (1)
  540. partata.Texture = "http://www.roblox.com/asset/?id=254711773"
  541. partata.Color = ColorSequence.new(Color3.new(0, 0, 0),Color3.new(0, 0, 0))
  542. Weld(hole,bottomp,0,-.8)
  543. Mesh(hole,'cyl')
  544. --EAsings--
  545. Styles={
  546. Linear = function(alpha)
  547. return alpha
  548. end;
  549. easeInSine = function(alpha)
  550. local alpha = (1-math.cos(alpha*(math.pi/2)))
  551. return alpha
  552. end;
  553. easeOutSine = function(alpha)
  554. alpha = math.sin(alpha*(math.pi/2))
  555. return alpha
  556. end;
  557. easeInOutSine = function(alpha)
  558. alpha = alpha*2
  559. if alpha < 1 then
  560. return 0.5*Styles["easeInSine"](alpha)
  561. else
  562. return 0.5*Styles["easeOutSine"](alpha-1)+.5
  563. end
  564. end;
  565.  
  566. easeInQuadratic = function(alpha)
  567. alpha = alpha^2
  568. return alpha
  569. end;
  570. easeOutQuadratic = function(alpha)
  571. _alpha = 1-alpha
  572. alpha = 1-_alpha*_alpha
  573. return alpha
  574. end;
  575. easeInOutQuadratic = function(alpha)
  576. alpha = alpha*2
  577. if alpha < 1 then
  578. return 0.5*Styles["easeInQuadratic"](alpha)
  579. else
  580. return 0.5*Styles["easeOutQuadratic"](alpha-1)+0.5
  581. end
  582. end;
  583.  
  584. easeInCubic = function(alpha)
  585. alpha = alpha^3
  586. return alpha
  587. end;
  588. easeOutCubic = function(alpha)
  589. alpha = 1-alpha
  590. return 1-alpha^3
  591. end;
  592. easeInOutCubic = function(alpha)
  593. alpha = alpha*2
  594. if alpha < 1 then
  595. return 0.5*Styles["easeInCubic"](alpha)
  596. else
  597. return 0.5*Styles["easeOutCubic"](alpha-1)+.5
  598. end
  599. end;
  600. }
  601. function Interpolate(Type,p0,p1)
  602. local Data = {Style = Styles[Type],PointA = p0,PointB = p1}
  603. return function(Perc)
  604. local Perc = Data.Style(Perc)
  605. return Data.PointA:lerp(Data.PointB,Perc)
  606. end
  607. end
  608. function NewLimbAnim(anim)
  609. for _,v in pairs(Joints)do
  610. v:NewAnim(anim)
  611. end
  612. end
  613. Animations={}
  614. Animation={prev=nil}
  615. function Animation.new(name,lenght,style,insert)
  616. local Anim={
  617. Span=lenght;
  618. Location=insert;
  619. Count=0;
  620. Keyframes={}; --Aliases
  621. Playing=false;
  622. Loop=false;
  623. reset_on_loop=true;
  624. Name=name;
  625. }
  626. for i,v in pairs(Joints)do
  627. Anim.Keyframes[i]=v
  628. end
  629. function Anim:Play()
  630. self.Playing=true
  631. self.Count=0
  632. -- anim_script.Disabled=true
  633. Animation.prev = self
  634. end
  635. function Anim:Stop()
  636. -- if self.reset_on_loop==true then RevertAll() end
  637. self.Playing=false
  638. self.Count=0
  639. -- anim_script.Disabled=false
  640. -- Animation.prev=nil
  641. -- RevertAll()
  642. end
  643. local Time=tick()
  644. function Anim:Add(Time,limb,c0,c1)
  645. if Time>self.Span then error"one simply does not travel to future..."end
  646. local Tab={TimeOfAction=Time,Joint=limb,frame={C0=c0 or self.Keyframes[limb].n_c0,C1=c1 or self.Keyframes[limb].n_c1}}
  647. table.insert(self.Keyframes[limb].keys[self.Location],Tab)
  648. table.sort(self.Keyframes[limb].keys[self.Location],function(a,b) return a.TimeOfAction < b.TimeOfAction end)
  649. end
  650. function Anim:Exec(smooth)
  651. local DT=tick()-Time
  652. Time=tick()
  653. local First,Current,Next
  654. if self.Playing then --Check if anim can play
  655. self.Count=self.Count+DT --it goes up
  656. if self.Loop then --Reset when at end if loop
  657. if self.Count >= self.Span then
  658. self.Count=0
  659. if self.onCycle then
  660. self.onCycle(self)
  661. end
  662. end
  663. elseif not self.Loop then
  664. if self.Count >= self.Span then
  665. self.Count=self.Span
  666.  
  667. if self.onFinish then
  668. self.onFinish(self)
  669. end
  670. end
  671. end
  672. for i,v in pairs(self.Keyframes) do
  673. if v._can_kf then
  674. for i2,v2 in pairs(v.keys[self.Location]) do --cframes are stored in joints. self.Location is the name of animation
  675. First = v.keys[self.Location][1]
  676. Current = v2
  677. Next = v.keys[self.Location][i2+1]
  678. -- print(i2)
  679. if Next ~= nil and self.Count >= Current.TimeOfAction and self.Count <= Next.TimeOfAction then
  680. local Dis = (Next.TimeOfAction-Current.TimeOfAction)
  681. local Perc = (self.Count-Current.TimeOfAction)/Dis
  682. v.w.C0 = Interpolate(style or 'Linear',Current.frame.C0,Next.frame.C0)(Perc)
  683. v.w.C1 = Interpolate(style or 'Linear',Current.frame.C1,Next.frame.C1)(Perc)
  684.  
  685. v.previous = v.w.C0
  686.  
  687. end
  688. end end
  689. end
  690. end
  691. end
  692. Animations[name]=Anim
  693. return Anim
  694. end
  695. previous_kfl=nil
  696. function newAnim(name,lenght,loop,style,strange) --Epic wrapper for epic skids
  697. NewLimbAnim(name)
  698. local a=Animation.new(name,lenght,style,name)
  699.  
  700. if loop~=nil then
  701. a.Loop=loop
  702. end
  703.  
  704. return function(kfs)
  705. if not kfs[0] then
  706. local t={}
  707. for j,v in pairs(Joints) do
  708. t[j]=v.previous
  709. end
  710. kfs[0]=t
  711. end
  712. a.kfl=kfs
  713.  
  714. function a:last()
  715. local n,o=-1,nil
  716. for i,v in pairs(self.kfl)do
  717. if i>n then
  718. n=i o=v
  719. if type(o)=='number' then
  720. o=self.kfl[o]
  721. end
  722. end
  723. end
  724. return o
  725. end
  726. function a:Wait(num)
  727. repeat wait()until self.Count>=(num or self.Span)
  728. end
  729. if lenght==0 then
  730. for i,v in pairs(kfs) do
  731. a.Span=i
  732. end
  733. end
  734. for tim,kf in pairs(kfs) do
  735. local kk=kf
  736. if type(kf) =='number'then
  737. kk=kfs[kf]
  738. end
  739.  
  740. for j,v in pairs(kk) do
  741. if not strange then
  742. a:Add(tim,j, (v == 0 and Joints[j].n_c0 or (Joints[j].n_c0 * v) ))
  743. else
  744. a:Add(tim,j, (v == 0 and Joints[j].n_c0 or v ))
  745. end
  746. end
  747. end
  748. return a
  749. end
  750. end
  751. local facetick=tick()
  752. LerParts={}
  753. function LerParts:Add(tag,part,value,speed)
  754. local tt = {
  755. p=part;c=value;s=speed;t=tag;
  756. }
  757. function tt:Kill()
  758. self.p:Destroy()
  759. LerParts[self.t]=nil
  760. end
  761. self[tag]=tt
  762. end
  763. RS:BindToRenderStep('Anim',2000,function() --Mainloop
  764. for i,v in pairs(Animations)do --execute animations
  765. v:Exec()
  766. end
  767.  
  768. for i,v in pairs(LerParts) do --lerp parts
  769. if type(v)~='function'then
  770. v.p.CFrame=v.p.CFrame:lerp(v.c(),v.s)end
  771. end
  772.  
  773. end)
  774. function tablify(tab)
  775. setmetatable(tab,{
  776. __add = function(t,t2)
  777. if type(t2) ~= 'table' then return end --prevent errors
  778. local ta={}
  779. for i,v in pairs(t) do
  780. ta[i]=v
  781. end
  782. for i,v in pairs(t2) do
  783. ta[i] = v
  784. end
  785. return ta
  786. end
  787. })
  788. end
  789. local init={}
  790. tablify(init)
  791. for i,v in pairs(Joints)do
  792. init[i]=0
  793. end
  794. mighty=newAnim('c',1){
  795. [.1]=init+{t_p=ang(md'-45');
  796. s_r=ang(md'45',0,md'75');
  797. s_l=ang(md'45',0,md'-75');
  798. a_r=ang(md'25');
  799. a_l=ang(md'25');
  800. }
  801. }
  802.  
  803. armraise=newAnim('a',.5){
  804. [0]=init;
  805. [.25]={
  806. s_r=ang(md'90');
  807. };
  808. [.5]={
  809. h_r=ang(md'75');
  810. };
  811. }
  812. push=newAnim('a2',.25){
  813. [0]=init+{
  814. s_r=ang(md'90');
  815. h_r=ang(md'75');
  816. };
  817. [.25]={
  818. s_r=ang(md'90');
  819. a_r=ang(md'45');
  820. e_r=ang(md'15');
  821. };
  822. }
  823. function laser(st,en,r)
  824. total_mag=(st-en).magnitude
  825. prev=cfn(st)
  826. local mo=New"Model"{_P=Main}
  827. set_parent=mo
  828. local pm={-1,1}
  829. for i=0,1,.1 do
  830. local pos=cfn(st):lerp(cfn(en),i)
  831. local pos2=pos*cfn(pm[mr(#pm)]*r,0,pm[mr(#pm)]*r)
  832. local mag=(prev.p-pos2.p).magnitude
  833. local laz=Part(.1,mag,.1,'Really red',.5)_1.Anchored=true _1.Material='Neon'
  834. Mesh(_1,'bl',.5,1,.5)
  835. _1.CFrame=(cfn(prev.p,pos2.p)*cfn(0,0,-mag/2))*ang(PI/2)
  836. if i>.9 then
  837. _1.CFrame=(cfn(prev.p,pos2.p)*cfn(0,0,-mag/2))*ang(PI/2)
  838. end
  839. prev=pos2
  840. end
  841. set_parent=nil
  842. DEBRIS:AddItem(mo,.025)
  843. end
  844.  
  845. function sparks()
  846. local a=newAnim('sfss',2.1){
  847. [0]=init;
  848. [.25]={
  849. s_r=ang(md'100',md'-25');
  850. a_r=ang(0,0,md'-25');
  851. h_r=ang(md'-10');
  852.  
  853. s_l=ang(md'80',md'25');
  854. a_l=ang(0,0,md'25');
  855. h_l=ang(md'-10',PI);
  856.  
  857. e_r=ang(md'-5');
  858. e_l=ang(md'5');
  859. };
  860. [.75]={
  861. e_r=ang(md'25');
  862. e_l=ang(md'-25');
  863. };
  864. [2]=.75;
  865. [2.1]={
  866. e_r=ang(md'-5');
  867. e_l=ang(md'5');
  868. };
  869. }a:Play()
  870. a:Wait(.25)
  871. changeFace('happy')
  872. local p=Part(1,1,1,Robot.Color2)_1.Material='Neon'_1.Anchored=true
  873. p.CFrame=heart_r.CFrame:lerp(heart_l.CFrame,.5)
  874. LerParts:Add('orb',p,function()return heart_r.CFrame:lerp(heart_l.CFrame,.5)*ang(mr(-3,3),mr(-3,3),mr(-3,3))end,.25)
  875. -- Spawn(function()
  876. repeat
  877. laser(heart_r.Position,heart_l.Position,.25)
  878. for i,v in pairs(findHum(torso.Position,30))do
  879. if v~=human then
  880. v.Torso.Velocity=cfn(v.Torso.Position,torso.Position).lookVector*20
  881. v.Torso.RotVelocity=v3n(0,100,0)
  882. end end
  883. wait()
  884. until a.Count>=2
  885. changeFace('normal')
  886. LerParts['orb']:Kill()
  887. local ring=Part(1,1,1,'Really red',.5)_1.Anchored=true
  888. local msh=Mesh(_1,mesh_ids.ring)
  889. ring.CFrame=cfn(heart_r.CFrame:lerp(heart_l.CFrame,.5).p)*ang(PI/2,0,0)
  890. for i=0,1,.1 do
  891. msh.Scale=v3n(i*20,i*20,1)
  892. ring.Transparency=.5+i*.5
  893. wait()
  894. end
  895. ring:Destroy()
  896. a:Wait()a:Stop()
  897. reset()
  898. -- end)
  899.  
  900. end
  901. -- o=newAnim("werwer",.5){
  902. -- [0]=init;
  903. -- [.1]={
  904. -- t_p=ang(md'15',md'25');
  905. -- s_l=ang(md'45');
  906. -- s_r=ang(md'45');
  907. -- };
  908. -- [.5]={
  909. -- t_p=ang(md'-15',md'-25');
  910. -- s_l=ang(md'140',0,md'75');
  911. -- s_r=ang(md'140',0,md'75');
  912. -- h_r=ang(0,PI/2);
  913. -- a_l=0;
  914. -- };
  915. -- }o:Play()o:Wait()
  916. -- o.Playing=false
  917. -- o:Stop()
  918. -- o2=newAnim('ww',.5,true){
  919. -- [0]=o:last();
  920. -- [.2]={
  921. -- t_p=ang(md'15',md'25');
  922. -- s_l=ang(md'45',0,md'75');
  923. -- s_r=ang(md'45',0,md'75');
  924. -- a_l=ang(md'-15',md'15')
  925. -- };
  926. -- [.5]=0
  927. -- }o2:Play()
  928.  
  929. function reset()
  930. local cc=newAnim('sfs',.5,false,_,true){
  931. [.5]=init;
  932. }cc:Play()cc:Wait()cc:Stop()
  933. end
  934. human.Died:connect(function() --onDeath
  935. e=Instance.new("Explosion",Workspace)
  936. e.Position=torso.Position
  937. e.BlastRadius=30
  938. end)
  939. function beam()
  940. armraise.Count=0
  941. armraise:Play()
  942. armraise:Wait()
  943.  
  944. for i=1,30 do
  945. local bl=Part(.1,.1,.1,'Really red',.5)
  946. _1.Material='Neon'
  947. _1.CFrame=l(heart_r,mr(-3,3),mr(-3,3))
  948. Mesh(_1,'s')
  949. New"BodyPosition"{_P=bl;position=heart_r.Position}
  950. DEBRIS:AddItem(bl,.3)
  951. wait()
  952. end
  953.  
  954. local obj,pos=Workspace:FindPartOnRay(Ray.new(l(heart_r).p,l(heart_r).lookVector*100),character)
  955. if obj and pos then
  956. changeFace("xD")
  957. local mag = (l(heart_r).p-pos).magnitude
  958. local laz=Part(1,mag,1,'Really red')_1.Anchored=true
  959. local msh=Mesh(laz,'cyl')
  960. local lista={}
  961. laz.CFrame=(cfn(l(heart_r).p,pos)*cfn(0,0,-mag/2))*ang(PI/2)
  962.  
  963. for i,v in pairs(findHum(pos,10))do
  964. if v~=human then
  965. v.Health=0 end
  966. end
  967.  
  968. for i=0,1,1/4 do
  969. local r=Part(1,1,1,'Really red',.5)_1.Anchored=true
  970. r.CFrame=l(laz,0,-laz.Size.y/2+laz.Size.y*i,0,PI/2)
  971. local msh=Mesh(r,mesh_ids.ring)
  972. table.insert(lista,r)
  973. end
  974.  
  975. local ss=mesh_scales.ring*v3n(laz.Size.x,laz.Size.z,1)
  976. Spawn(function()
  977. for i=0,1,.05 do
  978. Edit{msh,laz}{Transparency=i;Scale=v3n(1+i*3,1,1+i*3)}
  979. Edit(lista){Transparency=i;['Mesh.Scale']=ss+v3n(i*10,i*10,1)}
  980. wait()
  981. end
  982. laz:Destroy()
  983. for i,v in pairs(lista)do v:Destroy()end
  984. end)
  985. end
  986. push:Play()
  987. push:Wait()
  988. push:Stop()
  989. armraise:Stop()
  990. changeFace('normal')
  991. reset()
  992. end
  993. Mouse=player:GetMouse()
  994. atacking=false
  995. mouse_con1=Mouse.KeyDown:connect(function(key)
  996. attacking=true
  997.  
  998. if key=='f'then
  999. beam()
  1000. elseif key=='r'then
  1001. sparks()
  1002. end
  1003.  
  1004. attacking=false
  1005. end)
  1006. --Maeking sure it wont go insane--
  1007. New"BindableFunction"{_P=script;Name='sidos'}.OnInvoke=function()
  1008. mouse_con1:disconnect()
  1009. end
  1010. script.Name='riimu'
  1011.  
  1012. z = Instance.new("Sound", hole)
  1013. z.SoundId = "rbxassetid://162701939" -- Put Music ID Here.
  1014. z.Looped = true
  1015. z.Volume = 1
  1016. wait(.1)
  1017. z:Play()
Add Comment
Please, Sign In to add comment