Dark_EccentricYT

Untitled

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