Roboto


SUBMITTED BY: Pamlau

DATE: March 8, 2017, 10:43 a.m.

FORMAT: Lua

SIZE: 28.4 kB

HITS: 521

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

comments powered by Disqus