Advertisement
Thefrozen106

Black.. Robot.. Script?

Jun 15th, 2017
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 81.22 KB | None | 0 0
  1. --run it with script bot
  2. --Local script
  3.  
  4. Robot = {}
  5. Robot.Name = "EvilMachine"
  6. Robot.Health=100
  7. Robot.Scale=1
  8. Robot.Color = "Really black"
  9. Robot.Color2 = "Really red"
  10. --declarations
  11. PI=math.pi
  12. TAU=PI*2
  13. DEBRIS=game:service'Debris'
  14. mr,md=math.random,math.rad
  15. cfn,v3n=CFrame.new,Vector3.new
  16. _A=nil
  17. ang=function(x,y,z)local a=CFrame.Angles(x or 0,y or 0,z or 0)_A=a return a end
  18. RS=game:service'RunService'
  19. bcol=BrickColor.new
  20. RS:UnbindFromRenderStep('Anim')
  21. --player specific...
  22. player = game.Players.LocalPlayer
  23. character = player.Character
  24. torso = character.Torso
  25. head = character.Head
  26. rarm = character['Right Arm']
  27. larm = character['Left Arm']
  28. rleg = character['Right Leg']
  29. rleg = character['Left Leg']
  30. human = character.Humanoid
  31. --Utilities... who needs them?
  32. function findHum(pos,rad,hum2)
  33. local hums={}
  34. function check(a)
  35. local res=false
  36. for i,ho in pairs(hums)do
  37. if a==ho then res=true end
  38. end
  39. return res
  40. end
  41. for i,v in pairs(Workspace:children())do
  42. if v:IsA'Model'and v~=Char and v~=(hum2 or Char) then
  43. for i,q in pairs(v:children())do
  44. if q:IsA'Humanoid' and q.Parent:FindFirstChild'Torso'and(q.Torso.Position-pos).magnitude < rad then
  45. if not check(q)then
  46. table.insert(hums,q)
  47. end
  48. end
  49. end
  50. end
  51. end
  52. return hums
  53. end
  54. function checkY(p1,p2,range,range2)
  55. local function checko()
  56. 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) )
  57. end
  58. if range2 then
  59. return (l(p1).Y > l(p2).Y-range and l(p2).Y < l(p2).Y+range) and checko()
  60. else
  61. return (l(p1).Y > l(p2).Y-range and l(p2).Y < l(p2).Y+range)
  62. end
  63. end
  64. udim=function(a,b,c,d)
  65. if type(a)=='string'then
  66. x,y=tostring(a):match('([%+%d%.%-%/%*]+),([%+%d%.%-%/%*]+)')
  67. return UDim2.new(x or 0,x2 or 0,y or 0,y2 or 0)
  68. else
  69. return UDim2.new(a or 0,c or 0,b or 0,d or 0)
  70. end end
  71. function l(a1,x,y,z,rx,ry,rz)
  72. local cf
  73. if tostring(a1):find(',') == nil then
  74. cf=a1.CFrame
  75. else cf=a1 end
  76. return cf*CFrame.new(x or 0,y or 0,z or 0)*CFrame.Angles(
  77. rx or 0,ry or 0,yz or 0)
  78. end
  79. function f(a) --turns thigns in to function returning the thing... f(l)(torso,0,2,0)
  80. return function(...)
  81. local args={...}
  82. return function() return a(unpack(args)) end
  83. end
  84. end
  85. function isIn(what,tab) --returns true if what is in tab. isIn("Troll", {"Tomato", "Troll", "Strawberry") --> true
  86. local res=false
  87. for i,v in next,tab do
  88. if v==what then
  89. res = true
  90. break
  91. end
  92. end
  93. return res
  94. end
  95. Weld = function(part0,part1,c0,c1,...) --over-engineered welding function which accepts many things
  96. local ar = {...}
  97. local cframe0,cframe1
  98. local function checkf()local res=true
  99. for i,v in pairs(ar)do
  100. if type(v) ~= 'number' then
  101. res=false
  102. end
  103. end
  104. return res
  105. end
  106. if type(c0) == 'table' then
  107. cframe0 = CFrame.new(c0[1] or 0, c0[2] or 0, c0[3] or 0) * CFrame.Angles(
  108. c0[4] or 0, c0[5] or 0, c0[6] or 0)
  109. elseif type(c0) == 'userdata' then
  110. cframe0 = c0
  111. elseif type(c0) == 'number' and checkf() then
  112. 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)
  113. end
  114. if type(c1) == 'table' then
  115. cframe1 = CFrame.new(c1[1] or 0, c1[2] or 0, c1[3] or 0) * CFrame.Angles(
  116. c1[4] or 0, c1[5] or 0, c1[6] or 0)
  117. elseif type(c1) == 'userdata' then
  118. cframe1 = c1
  119. elseif type(c1) == 'number' and (not c0 or (c0 and type(c0) == 'table')) then
  120. 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)
  121. end
  122. for i,v in pairs(ar)do
  123. if type(v) == 'table' then
  124. 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)
  125. elseif type(v) == 'userdata' then
  126. cframe1 = v
  127. end
  128. end
  129.  
  130. cframe0,cframe1 = cframe1,cframe0
  131. part0.Position=part1.Position
  132. local weld = Instance.new("Weld")
  133. weld.Part0 = part0
  134. weld.Part1 = part1
  135. weld.C0 = cframe0 or CFrame.new()
  136. weld.C1 = cframe1 or CFrame.new()
  137. if weld:IsA'Motor'then weld.MaxVelocity = set_maxvel or .1 end
  138. weld.Parent = part0
  139. _2=weld
  140. return weld
  141. end
  142. mesh_ids = {
  143. spikeball = "rbxassetid://0";
  144. spike = "rbxassetid://0";
  145. ring = "rbxassetid://0";
  146. coil = 'rbxassetid://0';
  147. diamond = 'rbxassetid://0';
  148. rock = 'rbxassetid://0';
  149. gear = 'rbxassetid://0';
  150. crown = 'rbxassetid://0';
  151. orb = 'rbxassetid://0';
  152. heart = 'rbxassetid://0';
  153. dragon = 'rbxassetid://0';
  154. }
  155. mesh_texs = {
  156. rock = 'rbxassetid://1290030';
  157. dragon = 'rbxassetid://25665033';
  158. }
  159. mesh_scales={
  160. diamond = v3n(0.75, 0.75, 0.75);
  161. spikeball = v3n(1.05, 1.05, 1.05);
  162. spike = v3n(0.5, 1.5, 0.5);
  163. gear = v3n(1.25,1.25,18);
  164. ring = v3n(1, 1, 6);
  165. coil = v3n(0.5, 0.5, 0.3);
  166. crown = v3n(0.6, 0.6, 0.6);
  167. orb = v3n(1, 1, 1);
  168. heart = v3n(0.25, 0.25, 0.4);
  169. dragon = v3n(0.4, 0.5, 0.4);
  170. }
  171. mesh_offsets={
  172. crown = v3n(0,.15,0);
  173. }
  174. function bindMesh(mesh,Size)
  175. local mesh_name
  176. local size=Size or mesh.Parent.Size
  177. for name,id in next,mesh_ids do
  178. if mesh.MeshId==id then
  179. mesh_name=name
  180. end
  181. end
  182. if not mesh_name then return end
  183. local mesh=mesh
  184. local con
  185. con=mesh.Parent.Changed:connect(function()
  186. local siz=mesh.Parent.Size
  187. mesh.Scale=siz*mesh_scales[mesh_name]
  188. if mesh_offsets[mesh_name] then
  189. mesh.Offset=siz*mesh_offsets[mesh_name]
  190. end
  191. end)
  192. return con
  193. end
  194. Mesh = function(parent,id,sx,sy,sz)
  195. local name = ( (id == 'cyl' and 'CylinderMesh') or (id == 'bl' and 'BlockMesh') or 'SpecialMesh')
  196. local mesh = Instance.new(name)
  197. if id == 's' then
  198. mesh.MeshType = Enum.MeshType.Sphere
  199. elseif id == 'w' then
  200. mesh.MeshType = Enum.MeshType.Wedge
  201. elseif id == 'h' then
  202. mesh.MeshType = Enum.MeshType.Head
  203. elseif string.find(id,"://") ~= nil then
  204. mesh.MeshId = id
  205. end
  206. mesh.Scale = Vector3.new(sx or 1, sy or 1, sz or 1)
  207. mesh.Parent = parent
  208. _3=mesh
  209. return mesh
  210. end
  211. Edit = function(what)
  212. return function(args)
  213. for ind,obj in next,what do
  214. for arg,val in next,args do
  215. local child,argu = arg:match"(.+)%.(.+)"
  216. if child and argu then
  217. if pcall(function()return obj[child][argu] end) then
  218. obj[child][argu]=val
  219. end
  220. else
  221. if arg=='_F'then
  222. val(ind,obj)
  223. elseif pcall(function()return obj[arg]end) then
  224. obj[arg]=val
  225. end
  226. end
  227. end
  228. end
  229. end
  230. end
  231. New = function(what) --Synthetic caffeine for Instance.new
  232. local obj
  233. if type(what) ~= 'string' then
  234. obj=what:Clone()
  235. else
  236. obj=Instance.new(what)
  237. end
  238. if what=='Weld' then obj.Name='mujoint'end
  239. return function(bar)
  240. for arg,val in pairs(bar) do
  241. if arg == "_P" then
  242. obj.Parent = val
  243. elseif arg=="_PP" then
  244. obj.Part0=val[1]
  245. obj.Part1=val[2]
  246. elseif arg=='_F'then
  247. val(obj)
  248. else
  249. if pcall(function()return obj[arg] end) then
  250. obj[arg]=val
  251. end
  252. end
  253. end _4=obj
  254. return obj
  255. end
  256. end
  257. set_parent,set_material=nil,nil
  258. set_maxvel,set_anchor=nil,nil
  259. _1,_2,_3,_4,_5,_6,_7,_8 = nil,nil,nil,nil,nil,nil,nil
  260. Part = function(x,y,z,col,tr)
  261. local p = New"Part"{
  262. _P=set_parent or ears or Main;
  263. BrickColor = BrickColor.new(col or set_color or "Really black");
  264. CanCollide = false;
  265. Transparency = tr or 0;
  266. Size = Vector3.new(x or 0,y or 0,z or 0);
  267. Material = set_material or 'SmoothPlastic';
  268. Anchored = (set_anchor~=nil and set_anchor or false)
  269. }
  270. for _,sur in next,Enum.NormalId:GetEnumItems() do
  271. p[sur.Name..'Surface'] = 10
  272. end
  273. _1 = p
  274. return p
  275. end
  276. Joints={}
  277. Joint={}
  278. Joint.new=function(name,weld,c0,c1)
  279. local joint={
  280. w=weld;
  281. part1=weld.Part1;
  282. n_c0=(c0 or weld.C0);
  283. n_c1=(c1 or weld.C1);
  284. name=name;
  285. previous=weld.C0;
  286. _can_kf=true;
  287. }
  288. joint.keys={};
  289. function joint:revertToOrig()
  290. self.w.C0=self.n_c0
  291. self.w.C1=self.n_c1
  292. end
  293. function joint:NewAnim(anim)
  294. self.keys[anim]={}
  295. end
  296. setmetatable(joint,{
  297. __mul=function(ta,val)
  298. return ta.n_c0*val
  299. end;
  300. })
  301. getfenv()[name]=joint
  302. Joints[name]=joint
  303. return joint
  304. end
  305. pcall(function() character[Robot.Name]:Destroy() end) --removes old model.
  306. pcall(function()character.Head.face.Transparency=1 end)
  307. Main = New"Model"{_P=character;Name = Robot.Name}
  308. for i,v in pairs(character:children())do
  309. if v:IsA'Hat'then v.Handle.Transparency=1
  310. elseif v:IsA'Part'then
  311. v.Transparency=1 end
  312. end
  313. --Torso...
  314. midp=Part(4,1.5,2)_1.Transparency=1
  315. Weld(midp,torso)
  316. bottomp=Part(2,1.5,1.5,_,1)
  317. Joint.new('b_p',Weld(bottomp,midp,0,-.75))
  318. --Cage--
  319. back_wall=Part(2,1.5,.25)
  320. Weld(_1,bottomp,0,0,.75-.125)
  321. front_wall=Part(2,1.25,.25)
  322. -- Weld(_1,bottomp,0,0,-.75-.125)
  323. cabin_mot=New"Motor"{_P=front_wall;_PP={front_wall,bottomp};
  324. C1=cfn(0,.75,-.75+.125)*ang(0,PI/2);C0=cfn(0,1.25/2,0)*ang(0,PI/2);
  325. MaxVelocity=.1}
  326. -- Spawn(function() --demonstration of secret cabinet
  327. -- while wait(1)do
  328. -- cabin_mot.DesiredAngle=PI/2
  329. -- wait(1)
  330. -- cabin_mot.DesiredAngle=0
  331. -- end end)
  332. bottom_wall=Part(2,.25,1.5)
  333. Weld(bottom_wall,bottomp,0,-.75+.125)
  334. --Sides
  335. p=Part(1.5,1.5,.75)Mesh(p,'w')
  336. Weld(p,bottomp,-1-.75/2,0,0,PI,PI/2)
  337. p=Part(1.5,1.5,.75)Mesh(p,'w')
  338. Weld(p,bottomp,1+.75/2,0,0,PI,-PI/2)
  339. topp=Part(4,1.5,2)
  340. -- Weld(topp,bottomp,0,1.5)
  341. Joint.new('t_p',New"Weld"{_P=topp;_PP={topp,bottomp};C1=cfn(0,.75,0);C0=cfn(0,-.75,0)})
  342. --head
  343. hed=Part(1,1,1)
  344. Weld(hed,topp,0,.75+.5)
  345. for _,v in pairs{ {.55,0};{-.55,PI} } do
  346. local p=Part(.35,.1,.35)Mesh(_1,'cyl')
  347. Weld(_1,hed,v[1],.235,0,0,v[2],PI/2)
  348. local p2=Part(.35,.1,.35)Mesh(p2,'s')
  349. Weld(p2,p,0,-.05)
  350. local cyl=Part(.1,.25,.1)
  351. Mesh(_1,'cyl',.5,1,.5)
  352. Weld(cyl,p,.35/2+(.25/2-.05),-.025,0,PI/2,0,PI/2)
  353. local cyl2=Part(.1,.25,.1)
  354. Mesh(_1,'cyl',.25,1/2,.25)
  355. Weld(cyl2,cyl,0,-.125-(.125/2))
  356. local cyl3=Part(.1,.25,.1)
  357. Mesh(_1,'cyl',.125,1/2,.125)
  358. Weld(cyl3,cyl2,0,-.25/2)
  359. end
  360. --Faces--
  361. faces={}
  362. 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]]"
  363. 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]]"
  364. 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]]"
  365. 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]]"
  366. 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]]"
  367. 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]]"
  368. 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]]"
  369. htp=game:service'HttpService'
  370. bitmap=htp:JSONDecode(faces.normal)
  371. surfg=New"SurfaceGui"{_P=hed;Face='Front';Size=udim'1,1'}
  372. fr=New"Frame"{_P=surfg;Size=udim'1,1';BackgroundTransparency=1}
  373. for y=1,10 do
  374. for x=1,10 do
  375. local f=New"Frame"{_P=fr;Size=udim(1/10,1/10);Position=udim( (-1+x)*1/10,(-1+y)*1/10 );
  376. BackgroundColor=bcol(Robot.Color2);BackgroundTransparency=1;
  377. }
  378. for _,v in pairs(bitmap) do
  379. if v[1] and v[2] then
  380. if x-1==v[1] and y-1==v[2] then
  381. f.BackgroundTransparency=0
  382. end
  383. end
  384. end
  385. -- if bitmap[y][x] ~= nil and bitmap[y][x]==1 then
  386. -- f.BackgroundTransparency=0
  387. -- end
  388. end
  389. end
  390. function changeFace(face)
  391. local bitmap=htp:JSONDecode(faces[face])
  392. fr:ClearAllChildren()
  393. for y=1,10 do
  394. for x=1,10 do
  395. -- print(x,y)
  396. f=New"Frame"{_P=fr;Size=udim(1/10,1/10);Position=udim( (-1+x)*1/10,(-1+y)*1/10 );
  397. BackgroundColor=bcol(Robot.Color2);BackgroundTransparency=1;
  398. }
  399. for _,v in pairs(bitmap) do
  400. if v[1] and v[2] then
  401. if x-1==v[1] and y-1==v[2] then
  402. f.BackgroundTransparency=0
  403. end
  404. end
  405. end
  406. end
  407. end
  408. prevface=faces[face]
  409. end
  410. ----
  411. --Health display
  412. function newseg(le,x,y,z,rx,ry,rz)
  413. local segment={}
  414. segment.modl=New"Model"{_P=Main;Name='Segment'}
  415. set_parent=segment.modl
  416. le=le or .5
  417. local p=Part(le,.1,.1,'Really red')Mesh(p,'bl',1,.5,.1)
  418. Weld(p,bgp,x,y,z,rx,ry,rz)
  419. local p2=Part(.1,.1,.1,'Really red')Mesh(p2,'bl',.35,.35,.1)
  420. Weld(p2,p,le/2,0,0,0,0,PI/4)
  421. local p22=Part(.1,.1,.1,'Really red')Mesh(p22,'bl',.35,.35,.1)
  422. Weld(p22,p,-le/2,0,0,0,0,PI/4)
  423.  
  424. Edit{p,p2,p22}{Material='Neon';Transparency=1}
  425.  
  426. function segment:light(a)
  427. for i,v in pairs(self.modl:children())do
  428. v.BrickColor=bcol'Really red'
  429. v.Material='Neon'
  430. v.Transparency=a or 0
  431. end
  432. end
  433.  
  434. function segment:dim(a)
  435. for i,v in pairs(self.modl:children())do
  436. v.BrickColor=bcol'Hurricane rgey'
  437. v.Material='SmoothPlastic'
  438. v.Transparency=.9
  439. end
  440. end
  441. set_parent=nil
  442.  
  443. return segment
  444. end
  445. letters = {
  446. [0]='1111110';[1]='0110000';[2]='1101101';[3]='1111001';[4]='0110011';[5]='1011011';
  447. [6]='1011111';[7]='1110000';[8]='1111111';[9]='1111011';
  448. ['A']='1110111';['b']='0011111';['C']='1001110';['d']='0111101';['E']='1001111';['F']='1000111'
  449. }
  450. function new7Dig(x,y,z,rx,ry,rz)
  451. local disp = {}
  452. disp.segs={}
  453.  
  454. bgp=Part(.75,1,.1,'Black')
  455. Weld(bgp,topp,x,y,z,rx,ry,rz)
  456.  
  457. disp.segs[1]=newseg(_,0,.4,-.1) --top
  458. disp.segs[6]=newseg(.25,.75*.4,.2,-.1,0,0,PI/2) --second top
  459. disp.segs[2]=newseg(.25,-.75*.4,.2,-.1,0,0,PI/2)
  460.  
  461. disp.segs[7]=newseg(_,0,0,-.1) --middle
  462. disp.segs[5]=newseg(.25,.75*.4,-.2,-.1,0,0,PI/2) --second bottom
  463. disp.segs[3]=newseg(.25,-.75*.4,-.2,-.1,0,0,PI/2)
  464.  
  465. disp.segs[4]=newseg(_,0,-.4,-.1) --bottom
  466.  
  467. function disp:show(letter)
  468. for i,v in pairs(disp.segs)do
  469. v:dim()
  470. end
  471. local str=letters[tonumber(letter)]
  472. for i=1,7 do
  473. -- print(i)
  474. local s=str:sub(i,i)
  475. if s=='1' then
  476. self.segs[i]:light()
  477. end
  478. end
  479. end
  480. return disp
  481. end
  482. D2=new7Dig(0,0,-1.05)
  483. D=new7Dig(.75,0,-1.05)
  484. D3=new7Dig(-.75,0,-1.05)
  485. local prevhp=99
  486. prevface=faces.normal
  487. human.HealthChanged:connect(function(hp)
  488. local str=tostring(math.floor(hp))
  489. if #str==3 then
  490. D:show(str:sub(1,1))
  491. D2:show(str:sub(2,2))
  492. D3:show(str:sub(3,3))
  493. elseif #str==2 then
  494. D:show(0)
  495. D2:show(str:sub(1,1))
  496. D3:show(str:sub(2,2))
  497. elseif #str==1 then
  498. D:show(0)
  499. D2:show(0)
  500. D3:show(str:sub(1,1))
  501. end
  502. end)
  503. human.Health=99
  504. ----
  505. --Right arm...
  506. s=Part(1.25,1.25,1.25)
  507. Joint.new('s_r',New"Motor"{_P=s;_PP={s,topp};C1=cfn(3-.625,.75,0)*ang(0,PI)})
  508. a1=Part(1,1.5,1)
  509. Joint.new('e_r',New"Motor"{_P=a1;_PP={a1,s};C1=cfn(0,-1.25/2,0);C0=cfn(0,.75,0)})
  510. a2=Part(1,1.5,1,_,.5)
  511. Joint.new('a_r',New"Motor"{_P=a1;_PP={a2,a1};C1=cfn(0,-.75,0);C0=cfn(0,.75,0)})
  512. --Another secret cabinet
  513. cabin_mot.DesiredAngle=PI/2
  514. front_wall=Part(1,1.4,.1)
  515. Weld(_1,a2,0,-.05,.5-.1)
  516. back_wall=Part(1,1.4,.1)
  517. Weld(_1,a2,0,-.05,-.5+.1)
  518. top_wall=Part(1,.1,1,'Black')
  519. Weld(top_wall,a2,0,.75-.05)
  520. local hand_r=Part(1.1,.75,.5)
  521. Joint.new('h_r',New"Motor"{_P=hand_r;_PP={hand_r,a2};C1=cfn(0,-.75,0);C0=cfn(0,.75/2,0)})
  522. local heart_r=Part(.5,.5,.1,Robot.Color2)
  523. Weld(_1,hand_r,0,0,-.25)
  524. --Left arm...
  525. s=Part(1.25,1.25,1.25)
  526. Joint.new('s_l',New"Motor"{_P=s;_PP={s,topp};C1=cfn(-(3-.625),.75,0)*ang(0,PI)})
  527. a1=Part(1,1.5,1)
  528. Joint.new('e_l',New"Motor"{_P=a1;_PP={a1,s};C1=cfn(0,-1.25/2,0);C0=cfn(0,.75,0)})
  529. a2=Part(1,1.5,1)
  530. Joint.new('a_l',New"Motor"{_P=a1;_PP={a2,a1};C1=cfn(0,-.75,0);C0=cfn(0,.75,0)})
  531. hand_l=Part(1.1,.75,.5)
  532. Joint.new('h_l',New"Motor"{_P=hand_l;_PP={hand_l,a2};C1=cfn(0,-.75,0);C0=cfn(0,.75/2,0)})
  533. heart_l=Part(.5,.5,.1,Robot.Color2)
  534. Weld(_1,hand_l,0,0,-.25)
  535. human.HipHeight=3
  536. hole=Part(1.25*.8,.1,1.25*.8,'Black')
  537. local partata = New"ParticleEmitter"{_P=hole;}
  538. partata.Size = NumberSequence.new(30,2,1)
  539. partata.Speed = NumberRange.new (-4)
  540. partata.Lifetime = NumberRange.new (1)
  541. partata.Texture = "http://www.roblox.com/asset/?id=254711773"
  542. partata.Color = ColorSequence.new(Color3.new(0, 0, 0),Color3.new(0, 0, 0))
  543. Weld(hole,bottomp,0,-.8)
  544. Mesh(hole,'cyl')
  545. --EAsings--
  546. Styles={
  547. Linear = function(alpha)
  548. return alpha
  549. end;
  550. easeInSine = function(alpha)
  551. local alpha = (1-math.cos(alpha*(math.pi/2)))
  552. return alpha
  553. end;
  554. easeOutSine = function(alpha)
  555. alpha = math.sin(alpha*(math.pi/2))
  556. return alpha
  557. end;
  558. easeInOutSine = function(alpha)
  559. alpha = alpha*2
  560. if alpha < 1 then
  561. return 0.5*Styles["easeInSine"](alpha)
  562. else
  563. return 0.5*Styles["easeOutSine"](alpha-1)+.5
  564. end
  565. end;
  566.  
  567. easeInQuadratic = function(alpha)
  568. alpha = alpha^2
  569. return alpha
  570. end;
  571. easeOutQuadratic = function(alpha)
  572. _alpha = 1-alpha
  573. alpha = 1-_alpha*_alpha
  574. return alpha
  575. end;
  576. easeInOutQuadratic = function(alpha)
  577. alpha = alpha*2
  578. if alpha < 1 then
  579. return 0.5*Styles["easeInQuadratic"](alpha)
  580. else
  581. return 0.5*Styles["easeOutQuadratic"](alpha-1)+0.5
  582. end
  583. end;
  584.  
  585. easeInCubic = function(alpha)
  586. alpha = alpha^3
  587. return alpha
  588. end;
  589. easeOutCubic = function(alpha)
  590. alpha = 1-alpha
  591. return 1-alpha^3
  592. end;
  593. easeInOutCubic = function(alpha)
  594. alpha = alpha*2
  595. if alpha < 1 then
  596. return 0.5*Styles["easeInCubic"](alpha)
  597. else
  598. return 0.5*Styles["easeOutCubic"](alpha-1)+.5
  599. end
  600. end;
  601. }
  602. function Interpolate(Type,p0,p1)
  603. local Data = {Style = Styles[Type],PointA = p0,PointB = p1}
  604. return function(Perc)
  605. local Perc = Data.Style(Perc)
  606. return Data.PointA:lerp(Data.PointB,Perc)
  607. end
  608. end
  609. function NewLimbAnim(anim)
  610. for _,v in pairs(Joints)do
  611. v:NewAnim(anim)
  612. end
  613. end
  614. Animations={}
  615. Animation={prev=nil}
  616. function Animation.new(name,lenght,style,insert)
  617. local Anim={
  618. Span=lenght;
  619. Location=insert;
  620. Count=0;
  621. Keyframes={}; --Aliases
  622. Playing=false;
  623. Loop=false;
  624. reset_on_loop=true;
  625. Name=name;
  626. }
  627. for i,v in pairs(Joints)do
  628. Anim.Keyframes[i]=v
  629. end
  630. function Anim:Play()
  631. self.Playing=true
  632. self.Count=0
  633. -- anim_script.Disabled=true
  634. Animation.prev = self
  635. end
  636. function Anim:Stop()
  637. -- if self.reset_on_loop==true then RevertAll() end
  638. self.Playing=false
  639. self.Count=0
  640. -- anim_script.Disabled=false
  641. -- Animation.prev=nil
  642. -- RevertAll()
  643. end
  644. local Time=tick()
  645. function Anim:Add(Time,limb,c0,c1)
  646. if Time>self.Span then error"one simply does not travel to future..."end
  647. local Tab={TimeOfAction=Time,Joint=limb,frame={C0=c0 or self.Keyframes[limb].n_c0,C1=c1 or self.Keyframes[limb].n_c1}}
  648. table.insert(self.Keyframes[limb].keys[self.Location],Tab)
  649. table.sort(self.Keyframes[limb].keys[self.Location],function(a,b) return a.TimeOfAction < b.TimeOfAction end)
  650. end
  651. function Anim:Exec(smooth)
  652. local DT=tick()-Time
  653. Time=tick()
  654. local First,Current,Next
  655. if self.Playing then --Check if anim can play
  656. self.Count=self.Count+DT --it goes up
  657. if self.Loop then --Reset when at end if loop
  658. if self.Count >= self.Span then
  659. self.Count=0
  660. if self.onCycle then
  661. self.onCycle(self)
  662. end
  663. end
  664. elseif not self.Loop then
  665. if self.Count >= self.Span then
  666. self.Count=self.Span
  667.  
  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.  
  686. v.previous = v.w.C0
  687.  
  688. end
  689. end end
  690. end
  691. end
  692. end
  693. Animations[name]=Anim
  694. return Anim
  695. end
  696. previous_kfl=nil
  697. function newAnim(name,lenght,loop,style,strange) --Epic wrapper for epic skids
  698. NewLimbAnim(name)
  699. local a=Animation.new(name,lenght,style,name)
  700.  
  701. if loop~=nil then
  702. a.Loop=loop
  703. end
  704.  
  705. return function(kfs)
  706. if not kfs[0] then
  707. local t={}
  708. for j,v in pairs(Joints) do
  709. t[j]=v.previous
  710. end
  711. kfs[0]=t
  712. end
  713. a.kfl=kfs
  714.  
  715. function a:last()
  716. local n,o=-1,nil
  717. for i,v in pairs(self.kfl)do
  718. if i>n then
  719. n=i o=v
  720. if type(o)=='number' then
  721. o=self.kfl[o]
  722. end
  723. end
  724. end
  725. return o
  726. end
  727. function a:Wait(num)
  728. repeat wait()until self.Count>=(num or self.Span)
  729. end
  730. if lenght==0 then
  731. for i,v in pairs(kfs) do
  732. a.Span=i
  733. end
  734. end
  735. for tim,kf in pairs(kfs) do
  736. local kk=kf
  737. if type(kf) =='number'then
  738. kk=kfs[kf]
  739. end
  740.  
  741. for j,v in pairs(kk) do
  742. if not strange then
  743. a:Add(tim,j, (v == 0 and Joints[j].n_c0 or (Joints[j].n_c0 * v) ))
  744. else
  745. a:Add(tim,j, (v == 0 and Joints[j].n_c0 or v ))
  746. end
  747. end
  748. end
  749. return a
  750. end
  751. end
  752. local facetick=tick()
  753. LerParts={}
  754. function LerParts:Add(tag,part,value,speed)
  755. local tt = {
  756. p=part;c=value;s=speed;t=tag;
  757. }
  758. function tt:Kill()
  759. self.p:Destroy()
  760. LerParts[self.t]=nil
  761. end
  762. self[tag]=tt
  763. end
  764. RS:BindToRenderStep('Anim',2000,function() --Mainloop
  765. for i,v in pairs(Animations)do --execute animations
  766. v:Exec()
  767. end
  768.  
  769. for i,v in pairs(LerParts) do --lerp parts
  770. if type(v)~='function'then
  771. v.p.CFrame=v.p.CFrame:lerp(v.c(),v.s)end
  772. end
  773.  
  774. end)
  775. function tablify(tab)
  776. setmetatable(tab,{
  777. __add = function(t,t2)
  778. if type(t2) ~= 'table' then return end --prevent errors
  779. local ta={}
  780. for i,v in pairs(t) do
  781. ta[i]=v
  782. end
  783. for i,v in pairs(t2) do
  784. ta[i] = v
  785. end
  786. return ta
  787. end
  788. })
  789. end
  790. local init={}
  791. tablify(init)
  792. for i,v in pairs(Joints)do
  793. init[i]=0
  794. end
  795. mighty=newAnim('c',1){
  796. [.1]=init+{t_p=ang(md'-45');
  797. s_r=ang(md'45',0,md'75');
  798. s_l=ang(md'45',0,md'-75');
  799. a_r=ang(md'25');
  800. a_l=ang(md'25');
  801. }
  802. }
  803.  
  804. armraise=newAnim('a',.5){
  805. [0]=init;
  806. [.25]={
  807. s_r=ang(md'90');
  808. };
  809. [.5]={
  810. h_r=ang(md'75');
  811. };
  812. }
  813. push=newAnim('a2',.25){
  814. [0]=init+{
  815. s_r=ang(md'90');
  816. h_r=ang(md'75');
  817. };
  818. [.25]={
  819. s_r=ang(md'90');
  820. a_r=ang(md'45');
  821. e_r=ang(md'15');
  822. };
  823. }
  824. function laser(st,en,r)
  825. total_mag=(st-en).magnitude
  826. prev=cfn(st)
  827. local mo=New"Model"{_P=Main}
  828. set_parent=mo
  829. local pm={-1,1}
  830. for i=0,1,.1 do
  831. local pos=cfn(st):lerp(cfn(en),i)
  832. local pos2=pos*cfn(pm[mr(#pm)]*r,0,pm[mr(#pm)]*r)
  833. local mag=(prev.p-pos2.p).magnitude
  834. local laz=Part(.1,mag,.1,'Really red',.5)_1.Anchored=true _1.Material='Neon'
  835. Mesh(_1,'bl',.5,1,.5)
  836. _1.CFrame=(cfn(prev.p,pos2.p)*cfn(0,0,-mag/2))*ang(PI/2)
  837. if i>.9 then
  838. _1.CFrame=(cfn(prev.p,pos2.p)*cfn(0,0,-mag/2))*ang(PI/2)
  839. end
  840. prev=pos2
  841. end
  842. set_parent=nil
  843. DEBRIS:AddItem(mo,.025)
  844. end
  845.  
  846. function sparks()
  847. local a=newAnim('sfss',2.1){
  848. [0]=init;
  849. [.25]={
  850. s_r=ang(md'100',md'-25');
  851. a_r=ang(0,0,md'-25');
  852. h_r=ang(md'-10');
  853.  
  854. s_l=ang(md'80',md'25');
  855. a_l=ang(0,0,md'25');
  856. h_l=ang(md'-10',PI);
  857.  
  858. e_r=ang(md'-5');
  859. e_l=ang(md'5');
  860. };
  861. [.75]={
  862. e_r=ang(md'25');
  863. e_l=ang(md'-25');
  864. };
  865. [2]=.75;
  866. [2.1]={
  867. e_r=ang(md'-5');
  868. e_l=ang(md'5');
  869. };
  870. }a:Play()
  871. a:Wait(.25)
  872. changeFace('happy')
  873. local p=Part(1,1,1,Robot.Color2)_1.Material='Neon'_1.Anchored=true
  874. p.CFrame=heart_r.CFrame:lerp(heart_l.CFrame,.5)
  875. 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)
  876. -- Spawn(function()
  877. repeat
  878. laser(heart_r.Position,heart_l.Position,.25)
  879. for i,v in pairs(findHum(torso.Position,30))do
  880. if v~=human then
  881. v.Torso.Velocity=cfn(v.Torso.Position,torso.Position).lookVector*20
  882. v.Torso.RotVelocity=v3n(0,100,0)
  883. end end
  884. wait()
  885. until a.Count>=2
  886. changeFace('normal')
  887. LerParts['orb']:Kill()
  888. local ring=Part(1,1,1,'Really red',.5)_1.Anchored=true
  889. local msh=Mesh(_1,mesh_ids.ring)
  890. ring.CFrame=cfn(heart_r.CFrame:lerp(heart_l.CFrame,.5).p)*ang(PI/2,0,0)
  891. for i=0,1,.1 do
  892. msh.Scale=v3n(i*20,i*20,1)
  893. ring.Transparency=.5+i*.5
  894. wait()
  895. end
  896. ring:Destroy()
  897. a:Wait()a:Stop()
  898. reset()
  899. -- end)
  900.  
  901. end
  902. -- o=newAnim("werwer",.5){
  903. -- [0]=init;
  904. -- [.1]={
  905. -- t_p=ang(md'15',md'25');
  906. -- s_l=ang(md'45');
  907. -- s_r=ang(md'45');
  908. -- };
  909. -- [.5]={
  910. -- t_p=ang(md'-15',md'-25');
  911. -- s_l=ang(md'140',0,md'75');
  912. -- s_r=ang(md'140',0,md'75');
  913. -- h_r=ang(0,PI/2);
  914. -- a_l=0;
  915. -- };
  916. -- }o:Play()o:Wait()
  917. -- o.Playing=false
  918. -- o:Stop()
  919. -- o2=newAnim('ww',.5,true){
  920. -- [0]=o:last();
  921. -- [.2]={
  922. -- t_p=ang(md'15',md'25');
  923. -- s_l=ang(md'45',0,md'75');
  924. -- s_r=ang(md'45',0,md'75');
  925. -- a_l=ang(md'-15',md'15')
  926. -- };
  927. -- [.5]=0
  928. -- }o2:Play()
  929.  
  930. function reset()
  931. local cc=newAnim('sfs',.5,false,_,true){
  932. [.5]=init;
  933. }cc:Play()cc:Wait()cc:Stop()
  934. end
  935. human.Died:connect(function() --onDeath
  936. e=Instance.new("Explosion",Workspace)
  937. e.Position=torso.Position
  938. e.BlastRadius=30
  939. end)
  940. function beam()
  941. armraise.Count=0
  942. armraise:Play()
  943. armraise:Wait()
  944.  
  945. for i=1,30 do
  946. local bl=Part(.1,.1,.1,'Really red',.5)
  947. _1.Material='Neon'
  948. _1.CFrame=l(heart_r,mr(-3,3),mr(-3,3))
  949. Mesh(_1,'s')
  950. New"BodyPosition"{_P=bl;position=heart_r.Position}
  951. DEBRIS:AddItem(bl,.3)
  952. wait()
  953. end
  954.  
  955. local obj,pos=Workspace:FindPartOnRay(Ray.new(l(heart_r).p,l(heart_r).lookVector*100),character)
  956. if obj and pos then
  957. changeFace("xD")
  958. local mag = (l(heart_r).p-pos).magnitude
  959. local laz=Part(1,mag,1,'Really red')_1.Anchored=true
  960. local msh=Mesh(laz,'cyl')
  961. local lista={}
  962. laz.CFrame=(cfn(l(heart_r).p,pos)*cfn(0,0,-mag/2))*ang(PI/2)
  963.  
  964. for i,v in pairs(findHum(pos,10))do
  965. if v~=human then
  966. v.Health=0 end
  967. end
  968.  
  969. for i=0,1,1/4 do
  970. local r=Part(1,1,1,'Really red',.5)_1.Anchored=true
  971. r.CFrame=l(laz,0,-laz.Size.y/2+laz.Size.y*i,0,PI/2)
  972. local msh=Mesh(r,mesh_ids.ring)
  973. table.insert(lista,r)
  974. end
  975.  
  976. local ss=mesh_scales.ring*v3n(laz.Size.x,laz.Size.z,1)
  977. Spawn(function()
  978. for i=0,1,.05 do
  979. Edit{msh,laz}{Transparency=i;Scale=v3n(1+i*3,1,1+i*3)}
  980. Edit(lista){Transparency=i;['Mesh.Scale']=ss+v3n(i*10,i*10,1)}
  981. wait()
  982. end
  983. laz:Destroy()
  984. for i,v in pairs(lista)do v:Destroy()end
  985. end)
  986. end
  987. push:Play()
  988. push:Wait()
  989. push:Stop()
  990. armraise:Stop()
  991. changeFace('normal')
  992. reset()
  993. end
  994. Mouse=player:GetMouse()
  995. atacking=false
  996. mouse_con1=Mouse.KeyDown:connect(function(key)
  997. attacking=true
  998.  
  999. if key=='f'then
  1000. beam()
  1001. elseif key=='r'then
  1002. sparks()
  1003. end
  1004.  
  1005. attacking=false
  1006. end)
  1007. --Maeking sure it wont go insane--
  1008. New"BindableFunction"{_P=script;Name='sidos'}.OnInvoke=function()
  1009. mouse_con1:disconnect()
  1010. end
  1011. script.Name='riimu'
  1012.  
  1013. z = Instance.new("Sound", hole)
  1014. z.SoundId = "rbxassetid://162701939" -- Put Music ID Here.
  1015. z.Looped = true
  1016. z.Volume = 2
  1017. wait(.1)
  1018. z:Play()
  1019.  
  1020. Robot = {}
  1021. Robot.Name = "EvilMachine"
  1022. Robot.Health=100
  1023. Robot.Scale=1
  1024. Robot.Color = "Really black"
  1025. Robot.Color2 = "Really red"
  1026. --declarations
  1027. PI=math.pi
  1028. TAU=PI*2
  1029. DEBRIS=game:service'Debris'
  1030. mr,md=math.random,math.rad
  1031. cfn,v3n=CFrame.new,Vector3.new
  1032. _A=nil
  1033. ang=function(x,y,z)local a=CFrame.Angles(x or 0,y or 0,z or 0)_A=a return a end
  1034. RS=game:service'RunService'
  1035. bcol=BrickColor.new
  1036. RS:UnbindFromRenderStep('Anim')
  1037. --player specific...
  1038. player = game.Players.LocalPlayer
  1039. character = player.Character
  1040. torso = character.Torso
  1041. head = character.Head
  1042. rarm = character['Right Arm']
  1043. larm = character['Left Arm']
  1044. rleg = character['Right Leg']
  1045. rleg = character['Left Leg']
  1046. human = character.Humanoid
  1047. --Utilities... who needs them?
  1048. function findHum(pos,rad,hum2)
  1049. local hums={}
  1050. function check(a)
  1051. local res=false
  1052. for i,ho in pairs(hums)do
  1053. if a==ho then res=true end
  1054. end
  1055. return res
  1056. end
  1057. for i,v in pairs(Workspace:children())do
  1058. if v:IsA'Model'and v~=Char and v~=(hum2 or Char) then
  1059. for i,q in pairs(v:children())do
  1060. if q:IsA'Humanoid' and q.Parent:FindFirstChild'Torso'and(q.Torso.Position-pos).magnitude < rad then
  1061. if not check(q)then
  1062. table.insert(hums,q)
  1063. end
  1064. end
  1065. end
  1066. end
  1067. end
  1068. return hums
  1069. end
  1070. function checkY(p1,p2,range,range2)
  1071. local function checko()
  1072. 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) )
  1073. end
  1074. if range2 then
  1075. return (l(p1).Y > l(p2).Y-range and l(p2).Y < l(p2).Y+range) and checko()
  1076. else
  1077. return (l(p1).Y > l(p2).Y-range and l(p2).Y < l(p2).Y+range)
  1078. end
  1079. end
  1080. udim=function(a,b,c,d)
  1081. if type(a)=='string'then
  1082. x,y=tostring(a):match('([%+%d%.%-%/%*]+),([%+%d%.%-%/%*]+)')
  1083. return UDim2.new(x or 0,x2 or 0,y or 0,y2 or 0)
  1084. else
  1085. return UDim2.new(a or 0,c or 0,b or 0,d or 0)
  1086. end end
  1087. function l(a1,x,y,z,rx,ry,rz)
  1088. local cf
  1089. if tostring(a1):find(',') == nil then
  1090. cf=a1.CFrame
  1091. else cf=a1 end
  1092. return cf*CFrame.new(x or 0,y or 0,z or 0)*CFrame.Angles(
  1093. rx or 0,ry or 0,yz or 0)
  1094. end
  1095. function f(a) --turns thigns in to function returning the thing... f(l)(torso,0,2,0)
  1096. return function(...)
  1097. local args={...}
  1098. return function() return a(unpack(args)) end
  1099. end
  1100. end
  1101. function isIn(what,tab) --returns true if what is in tab. isIn("Troll", {"Tomato", "Troll", "Strawberry") --> true
  1102. local res=false
  1103. for i,v in next,tab do
  1104. if v==what then
  1105. res = true
  1106. break
  1107. end
  1108. end
  1109. return res
  1110. end
  1111. Weld = function(part0,part1,c0,c1,...) --over-engineered welding function which accepts many things
  1112. local ar = {...}
  1113. local cframe0,cframe1
  1114. local function checkf()local res=true
  1115. for i,v in pairs(ar)do
  1116. if type(v) ~= 'number' then
  1117. res=false
  1118. end
  1119. end
  1120. return res
  1121. end
  1122. if type(c0) == 'table' then
  1123. cframe0 = CFrame.new(c0[1] or 0, c0[2] or 0, c0[3] or 0) * CFrame.Angles(
  1124. c0[4] or 0, c0[5] or 0, c0[6] or 0)
  1125. elseif type(c0) == 'userdata' then
  1126. cframe0 = c0
  1127. elseif type(c0) == 'number' and checkf() then
  1128. 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)
  1129. end
  1130. if type(c1) == 'table' then
  1131. cframe1 = CFrame.new(c1[1] or 0, c1[2] or 0, c1[3] or 0) * CFrame.Angles(
  1132. c1[4] or 0, c1[5] or 0, c1[6] or 0)
  1133. elseif type(c1) == 'userdata' then
  1134. cframe1 = c1
  1135. elseif type(c1) == 'number' and (not c0 or (c0 and type(c0) == 'table')) then
  1136. 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)
  1137. end
  1138. for i,v in pairs(ar)do
  1139. if type(v) == 'table' then
  1140. 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)
  1141. elseif type(v) == 'userdata' then
  1142. cframe1 = v
  1143. end
  1144. end
  1145.  
  1146. cframe0,cframe1 = cframe1,cframe0
  1147. part0.Position=part1.Position
  1148. local weld = Instance.new("Weld")
  1149. weld.Part0 = part0
  1150. weld.Part1 = part1
  1151. weld.C0 = cframe0 or CFrame.new()
  1152. weld.C1 = cframe1 or CFrame.new()
  1153. if weld:IsA'Motor'then weld.MaxVelocity = set_maxvel or .1 end
  1154. weld.Parent = part0
  1155. _2=weld
  1156. return weld
  1157. end
  1158. mesh_ids = {
  1159. spikeball = "rbxassetid://0";
  1160. spike = "rbxassetid://0";
  1161. ring = "rbxassetid://0";
  1162. coil = 'rbxassetid://0';
  1163. diamond = 'rbxassetid://0';
  1164. rock = 'rbxassetid://0';
  1165. gear = 'rbxassetid://0';
  1166. crown = 'rbxassetid://0';
  1167. orb = 'rbxassetid://0';
  1168. heart = 'rbxassetid://0';
  1169. dragon = 'rbxassetid://0';
  1170. }
  1171. mesh_texs = {
  1172. rock = 'rbxassetid://1290030';
  1173. dragon = 'rbxassetid://25665033';
  1174. }
  1175. mesh_scales={
  1176. diamond = v3n(0.75, 0.75, 0.75);
  1177. spikeball = v3n(1.05, 1.05, 1.05);
  1178. spike = v3n(0.5, 1.5, 0.5);
  1179. gear = v3n(1.25,1.25,18);
  1180. ring = v3n(1, 1, 6);
  1181. coil = v3n(0.5, 0.5, 0.3);
  1182. crown = v3n(0.6, 0.6, 0.6);
  1183. orb = v3n(1, 1, 1);
  1184. heart = v3n(0.25, 0.25, 0.4);
  1185. dragon = v3n(0.4, 0.5, 0.4);
  1186. }
  1187. mesh_offsets={
  1188. crown = v3n(0,.15,0);
  1189. }
  1190. function bindMesh(mesh,Size)
  1191. local mesh_name
  1192. local size=Size or mesh.Parent.Size
  1193. for name,id in next,mesh_ids do
  1194. if mesh.MeshId==id then
  1195. mesh_name=name
  1196. end
  1197. end
  1198. if not mesh_name then return end
  1199. local mesh=mesh
  1200. local con
  1201. con=mesh.Parent.Changed:connect(function()
  1202. local siz=mesh.Parent.Size
  1203. mesh.Scale=siz*mesh_scales[mesh_name]
  1204. if mesh_offsets[mesh_name] then
  1205. mesh.Offset=siz*mesh_offsets[mesh_name]
  1206. end
  1207. end)
  1208. return con
  1209. end
  1210. Mesh = function(parent,id,sx,sy,sz)
  1211. local name = ( (id == 'cyl' and 'CylinderMesh') or (id == 'bl' and 'BlockMesh') or 'SpecialMesh')
  1212. local mesh = Instance.new(name)
  1213. if id == 's' then
  1214. mesh.MeshType = Enum.MeshType.Sphere
  1215. elseif id == 'w' then
  1216. mesh.MeshType = Enum.MeshType.Wedge
  1217. elseif id == 'h' then
  1218. mesh.MeshType = Enum.MeshType.Head
  1219. elseif string.find(id,"://") ~= nil then
  1220. mesh.MeshId = id
  1221. end
  1222. mesh.Scale = Vector3.new(sx or 1, sy or 1, sz or 1)
  1223. mesh.Parent = parent
  1224. _3=mesh
  1225. return mesh
  1226. end
  1227. Edit = function(what)
  1228. return function(args)
  1229. for ind,obj in next,what do
  1230. for arg,val in next,args do
  1231. local child,argu = arg:match"(.+)%.(.+)"
  1232. if child and argu then
  1233. if pcall(function()return obj[child][argu] end) then
  1234. obj[child][argu]=val
  1235. end
  1236. else
  1237. if arg=='_F'then
  1238. val(ind,obj)
  1239. elseif pcall(function()return obj[arg]end) then
  1240. obj[arg]=val
  1241. end
  1242. end
  1243. end
  1244. end
  1245. end
  1246. end
  1247. New = function(what) --Synthetic caffeine for Instance.new
  1248. local obj
  1249. if type(what) ~= 'string' then
  1250. obj=what:Clone()
  1251. else
  1252. obj=Instance.new(what)
  1253. end
  1254. if what=='Weld' then obj.Name='mujoint'end
  1255. return function(bar)
  1256. for arg,val in pairs(bar) do
  1257. if arg == "_P" then
  1258. obj.Parent = val
  1259. elseif arg=="_PP" then
  1260. obj.Part0=val[1]
  1261. obj.Part1=val[2]
  1262. elseif arg=='_F'then
  1263. val(obj)
  1264. else
  1265. if pcall(function()return obj[arg] end) then
  1266. obj[arg]=val
  1267. end
  1268. end
  1269. end _4=obj
  1270. return obj
  1271. end
  1272. end
  1273. set_parent,set_material=nil,nil
  1274. set_maxvel,set_anchor=nil,nil
  1275. _1,_2,_3,_4,_5,_6,_7,_8 = nil,nil,nil,nil,nil,nil,nil
  1276. Part = function(x,y,z,col,tr)
  1277. local p = New"Part"{
  1278. _P=set_parent or ears or Main;
  1279. BrickColor = BrickColor.new(col or set_color or "Really black");
  1280. CanCollide = false;
  1281. Transparency = tr or 0;
  1282. Size = Vector3.new(x or 0,y or 0,z or 0);
  1283. Material = set_material or 'SmoothPlastic';
  1284. Anchored = (set_anchor~=nil and set_anchor or false)
  1285. }
  1286. for _,sur in next,Enum.NormalId:GetEnumItems() do
  1287. p[sur.Name..'Surface'] = 10
  1288. end
  1289. _1 = p
  1290. return p
  1291. end
  1292. Joints={}
  1293. Joint={}
  1294. Joint.new=function(name,weld,c0,c1)
  1295. local joint={
  1296. w=weld;
  1297. part1=weld.Part1;
  1298. n_c0=(c0 or weld.C0);
  1299. n_c1=(c1 or weld.C1);
  1300. name=name;
  1301. previous=weld.C0;
  1302. _can_kf=true;
  1303. }
  1304. joint.keys={};
  1305. function joint:revertToOrig()
  1306. self.w.C0=self.n_c0
  1307. self.w.C1=self.n_c1
  1308. end
  1309. function joint:NewAnim(anim)
  1310. self.keys[anim]={}
  1311. end
  1312. setmetatable(joint,{
  1313. __mul=function(ta,val)
  1314. return ta.n_c0*val
  1315. end;
  1316. })
  1317. getfenv()[name]=joint
  1318. Joints[name]=joint
  1319. return joint
  1320. end
  1321. pcall(function() character[Robot.Name]:Destroy() end) --removes old model.
  1322. pcall(function()character.Head.face.Transparency=1 end)
  1323. Main = New"Model"{_P=character;Name = Robot.Name}
  1324. for i,v in pairs(character:children())do
  1325. if v:IsA'Hat'then v.Handle.Transparency=1
  1326. elseif v:IsA'Part'then
  1327. v.Transparency=1 end
  1328. end
  1329. --Torso...
  1330. midp=Part(4,1.5,2)_1.Transparency=1
  1331. Weld(midp,torso)
  1332. bottomp=Part(2,1.5,1.5,_,1)
  1333. Joint.new('b_p',Weld(bottomp,midp,0,-.75))
  1334. --Cage--
  1335. back_wall=Part(2,1.5,.25)
  1336. Weld(_1,bottomp,0,0,.75-.125)
  1337. front_wall=Part(2,1.25,.25)
  1338. -- Weld(_1,bottomp,0,0,-.75-.125)
  1339. cabin_mot=New"Motor"{_P=front_wall;_PP={front_wall,bottomp};
  1340. C1=cfn(0,.75,-.75+.125)*ang(0,PI/2);C0=cfn(0,1.25/2,0)*ang(0,PI/2);
  1341. MaxVelocity=.1}
  1342. -- Spawn(function() --demonstration of secret cabinet
  1343. -- while wait(1)do
  1344. -- cabin_mot.DesiredAngle=PI/2
  1345. -- wait(1)
  1346. -- cabin_mot.DesiredAngle=0
  1347. -- end end)
  1348. bottom_wall=Part(2,.25,1.5)
  1349. Weld(bottom_wall,bottomp,0,-.75+.125)
  1350. --Sides
  1351. p=Part(1.5,1.5,.75)Mesh(p,'w')
  1352. Weld(p,bottomp,-1-.75/2,0,0,PI,PI/2)
  1353. p=Part(1.5,1.5,.75)Mesh(p,'w')
  1354. Weld(p,bottomp,1+.75/2,0,0,PI,-PI/2)
  1355. topp=Part(4,1.5,2)
  1356. -- Weld(topp,bottomp,0,1.5)
  1357. Joint.new('t_p',New"Weld"{_P=topp;_PP={topp,bottomp};C1=cfn(0,.75,0);C0=cfn(0,-.75,0)})
  1358. --head
  1359. hed=Part(1,1,1)
  1360. Weld(hed,topp,0,.75+.5)
  1361. for _,v in pairs{ {.55,0};{-.55,PI} } do
  1362. local p=Part(.35,.1,.35)Mesh(_1,'cyl')
  1363. Weld(_1,hed,v[1],.235,0,0,v[2],PI/2)
  1364. local p2=Part(.35,.1,.35)Mesh(p2,'s')
  1365. Weld(p2,p,0,-.05)
  1366. local cyl=Part(.1,.25,.1)
  1367. Mesh(_1,'cyl',.5,1,.5)
  1368. Weld(cyl,p,.35/2+(.25/2-.05),-.025,0,PI/2,0,PI/2)
  1369. local cyl2=Part(.1,.25,.1)
  1370. Mesh(_1,'cyl',.25,1/2,.25)
  1371. Weld(cyl2,cyl,0,-.125-(.125/2))
  1372. local cyl3=Part(.1,.25,.1)
  1373. Mesh(_1,'cyl',.125,1/2,.125)
  1374. Weld(cyl3,cyl2,0,-.25/2)
  1375. end
  1376. --Faces--
  1377. faces={}
  1378. 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]]"
  1379. 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]]"
  1380. 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]]"
  1381. 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]]"
  1382. 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]]"
  1383. 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]]"
  1384. 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]]"
  1385. htp=game:service'HttpService'
  1386. bitmap=htp:JSONDecode(faces.normal)
  1387. surfg=New"SurfaceGui"{_P=hed;Face='Front';Size=udim'1,1'}
  1388. fr=New"Frame"{_P=surfg;Size=udim'1,1';BackgroundTransparency=1}
  1389. for y=1,10 do
  1390. for x=1,10 do
  1391. local f=New"Frame"{_P=fr;Size=udim(1/10,1/10);Position=udim( (-1+x)*1/10,(-1+y)*1/10 );
  1392. BackgroundColor=bcol(Robot.Color2);BackgroundTransparency=1;
  1393. }
  1394. for _,v in pairs(bitmap) do
  1395. if v[1] and v[2] then
  1396. if x-1==v[1] and y-1==v[2] then
  1397. f.BackgroundTransparency=0
  1398. end
  1399. end
  1400. end
  1401. -- if bitmap[y][x] ~= nil and bitmap[y][x]==1 then
  1402. -- f.BackgroundTransparency=0
  1403. -- end
  1404. end
  1405. end
  1406. function changeFace(face)
  1407. local bitmap=htp:JSONDecode(faces[face])
  1408. fr:ClearAllChildren()
  1409. for y=1,10 do
  1410. for x=1,10 do
  1411. -- print(x,y)
  1412. f=New"Frame"{_P=fr;Size=udim(1/10,1/10);Position=udim( (-1+x)*1/10,(-1+y)*1/10 );
  1413. BackgroundColor=bcol(Robot.Color2);BackgroundTransparency=1;
  1414. }
  1415. for _,v in pairs(bitmap) do
  1416. if v[1] and v[2] then
  1417. if x-1==v[1] and y-1==v[2] then
  1418. f.BackgroundTransparency=0
  1419. end
  1420. end
  1421. end
  1422. end
  1423. end
  1424. prevface=faces[face]
  1425. end
  1426. ----
  1427. --Health display
  1428. function newseg(le,x,y,z,rx,ry,rz)
  1429. local segment={}
  1430. segment.modl=New"Model"{_P=Main;Name='Segment'}
  1431. set_parent=segment.modl
  1432. le=le or .5
  1433. local p=Part(le,.1,.1,'Really red')Mesh(p,'bl',1,.5,.1)
  1434. Weld(p,bgp,x,y,z,rx,ry,rz)
  1435. local p2=Part(.1,.1,.1,'Really red')Mesh(p2,'bl',.35,.35,.1)
  1436. Weld(p2,p,le/2,0,0,0,0,PI/4)
  1437. local p22=Part(.1,.1,.1,'Really red')Mesh(p22,'bl',.35,.35,.1)
  1438. Weld(p22,p,-le/2,0,0,0,0,PI/4)
  1439.  
  1440. Edit{p,p2,p22}{Material='Neon';Transparency=1}
  1441.  
  1442. function segment:light(a)
  1443. for i,v in pairs(self.modl:children())do
  1444. v.BrickColor=bcol'Really red'
  1445. v.Material='Neon'
  1446. v.Transparency=a or 0
  1447. end
  1448. end
  1449.  
  1450. function segment:dim(a)
  1451. for i,v in pairs(self.modl:children())do
  1452. v.BrickColor=bcol'Hurricane rgey'
  1453. v.Material='SmoothPlastic'
  1454. v.Transparency=.9
  1455. end
  1456. end
  1457. set_parent=nil
  1458.  
  1459. return segment
  1460. end
  1461. letters = {
  1462. [0]='1111110';[1]='0110000';[2]='1101101';[3]='1111001';[4]='0110011';[5]='1011011';
  1463. [6]='1011111';[7]='1110000';[8]='1111111';[9]='1111011';
  1464. ['A']='1110111';['b']='0011111';['C']='1001110';['d']='0111101';['E']='1001111';['F']='1000111'
  1465. }
  1466. function new7Dig(x,y,z,rx,ry,rz)
  1467. local disp = {}
  1468. disp.segs={}
  1469.  
  1470. bgp=Part(.75,1,.1,'Black')
  1471. Weld(bgp,topp,x,y,z,rx,ry,rz)
  1472.  
  1473. disp.segs[1]=newseg(_,0,.4,-.1) --top
  1474. disp.segs[6]=newseg(.25,.75*.4,.2,-.1,0,0,PI/2) --second top
  1475. disp.segs[2]=newseg(.25,-.75*.4,.2,-.1,0,0,PI/2)
  1476.  
  1477. disp.segs[7]=newseg(_,0,0,-.1) --middle
  1478. disp.segs[5]=newseg(.25,.75*.4,-.2,-.1,0,0,PI/2) --second bottom
  1479. disp.segs[3]=newseg(.25,-.75*.4,-.2,-.1,0,0,PI/2)
  1480.  
  1481. disp.segs[4]=newseg(_,0,-.4,-.1) --bottom
  1482.  
  1483. function disp:show(letter)
  1484. for i,v in pairs(disp.segs)do
  1485. v:dim()
  1486. end
  1487. local str=letters[tonumber(letter)]
  1488. for i=1,7 do
  1489. -- print(i)
  1490. local s=str:sub(i,i)
  1491. if s=='1' then
  1492. self.segs[i]:light()
  1493. end
  1494. end
  1495. end
  1496. return disp
  1497. end
  1498. D2=new7Dig(0,0,-1.05)
  1499. D=new7Dig(.75,0,-1.05)
  1500. D3=new7Dig(-.75,0,-1.05)
  1501. local prevhp=99
  1502. prevface=faces.normal
  1503. human.HealthChanged:connect(function(hp)
  1504. local str=tostring(math.floor(hp))
  1505. if #str==3 then
  1506. D:show(str:sub(1,1))
  1507. D2:show(str:sub(2,2))
  1508. D3:show(str:sub(3,3))
  1509. elseif #str==2 then
  1510. D:show(0)
  1511. D2:show(str:sub(1,1))
  1512. D3:show(str:sub(2,2))
  1513. elseif #str==1 then
  1514. D:show(0)
  1515. D2:show(0)
  1516. D3:show(str:sub(1,1))
  1517. end
  1518. end)
  1519. human.Health=99
  1520. ----
  1521. --Right arm...
  1522. s=Part(1.25,1.25,1.25)
  1523. Joint.new('s_r',New"Motor"{_P=s;_PP={s,topp};C1=cfn(3-.625,.75,0)*ang(0,PI)})
  1524. a1=Part(1,1.5,1)
  1525. Joint.new('e_r',New"Motor"{_P=a1;_PP={a1,s};C1=cfn(0,-1.25/2,0);C0=cfn(0,.75,0)})
  1526. a2=Part(1,1.5,1,_,.5)
  1527. Joint.new('a_r',New"Motor"{_P=a1;_PP={a2,a1};C1=cfn(0,-.75,0);C0=cfn(0,.75,0)})
  1528. --Another secret cabinet
  1529. cabin_mot.DesiredAngle=PI/2
  1530. front_wall=Part(1,1.4,.1)
  1531. Weld(_1,a2,0,-.05,.5-.1)
  1532. back_wall=Part(1,1.4,.1)
  1533. Weld(_1,a2,0,-.05,-.5+.1)
  1534. top_wall=Part(1,.1,1,'Black')
  1535. Weld(top_wall,a2,0,.75-.05)
  1536. local hand_r=Part(1.1,.75,.5)
  1537. Joint.new('h_r',New"Motor"{_P=hand_r;_PP={hand_r,a2};C1=cfn(0,-.75,0);C0=cfn(0,.75/2,0)})
  1538. local heart_r=Part(.5,.5,.1,Robot.Color2)
  1539. Weld(_1,hand_r,0,0,-.25)
  1540. --Left arm...
  1541. s=Part(1.25,1.25,1.25)
  1542. Joint.new('s_l',New"Motor"{_P=s;_PP={s,topp};C1=cfn(-(3-.625),.75,0)*ang(0,PI)})
  1543. a1=Part(1,1.5,1)
  1544. Joint.new('e_l',New"Motor"{_P=a1;_PP={a1,s};C1=cfn(0,-1.25/2,0);C0=cfn(0,.75,0)})
  1545. a2=Part(1,1.5,1)
  1546. Joint.new('a_l',New"Motor"{_P=a1;_PP={a2,a1};C1=cfn(0,-.75,0);C0=cfn(0,.75,0)})
  1547. hand_l=Part(1.1,.75,.5)
  1548. Joint.new('h_l',New"Motor"{_P=hand_l;_PP={hand_l,a2};C1=cfn(0,-.75,0);C0=cfn(0,.75/2,0)})
  1549. heart_l=Part(.5,.5,.1,Robot.Color2)
  1550. Weld(_1,hand_l,0,0,-.25)
  1551. human.HipHeight=3
  1552. hole=Part(1.25*.8,.1,1.25*.8,'Black')
  1553. local partata = New"ParticleEmitter"{_P=hole;}
  1554. partata.Size = NumberSequence.new(30,2,1)
  1555. partata.Speed = NumberRange.new (-4)
  1556. partata.Lifetime = NumberRange.new (1)
  1557. partata.Texture = "http://www.roblox.com/asset/?id=254711773"
  1558. partata.Color = ColorSequence.new(Color3.new(0, 0, 0),Color3.new(0, 0, 0))
  1559. Weld(hole,bottomp,0,-.8)
  1560. Mesh(hole,'cyl')
  1561. --EAsings--
  1562. Styles={
  1563. Linear = function(alpha)
  1564. return alpha
  1565. end;
  1566. easeInSine = function(alpha)
  1567. local alpha = (1-math.cos(alpha*(math.pi/2)))
  1568. return alpha
  1569. end;
  1570. easeOutSine = function(alpha)
  1571. alpha = math.sin(alpha*(math.pi/2))
  1572. return alpha
  1573. end;
  1574. easeInOutSine = function(alpha)
  1575. alpha = alpha*2
  1576. if alpha < 1 then
  1577. return 0.5*Styles["easeInSine"](alpha)
  1578. else
  1579. return 0.5*Styles["easeOutSine"](alpha-1)+.5
  1580. end
  1581. end;
  1582.  
  1583. easeInQuadratic = function(alpha)
  1584. alpha = alpha^2
  1585. return alpha
  1586. end;
  1587. easeOutQuadratic = function(alpha)
  1588. _alpha = 1-alpha
  1589. alpha = 1-_alpha*_alpha
  1590. return alpha
  1591. end;
  1592. easeInOutQuadratic = function(alpha)
  1593. alpha = alpha*2
  1594. if alpha < 1 then
  1595. return 0.5*Styles["easeInQuadratic"](alpha)
  1596. else
  1597. return 0.5*Styles["easeOutQuadratic"](alpha-1)+0.5
  1598. end
  1599. end;
  1600.  
  1601. easeInCubic = function(alpha)
  1602. alpha = alpha^3
  1603. return alpha
  1604. end;
  1605. easeOutCubic = function(alpha)
  1606. alpha = 1-alpha
  1607. return 1-alpha^3
  1608. end;
  1609. easeInOutCubic = function(alpha)
  1610. alpha = alpha*2
  1611. if alpha < 1 then
  1612. return 0.5*Styles["easeInCubic"](alpha)
  1613. else
  1614. return 0.5*Styles["easeOutCubic"](alpha-1)+.5
  1615. end
  1616. end;
  1617. }
  1618. function Interpolate(Type,p0,p1)
  1619. local Data = {Style = Styles[Type],PointA = p0,PointB = p1}
  1620. return function(Perc)
  1621. local Perc = Data.Style(Perc)
  1622. return Data.PointA:lerp(Data.PointB,Perc)
  1623. end
  1624. end
  1625. function NewLimbAnim(anim)
  1626. for _,v in pairs(Joints)do
  1627. v:NewAnim(anim)
  1628. end
  1629. end
  1630. Animations={}
  1631. Animation={prev=nil}
  1632. function Animation.new(name,lenght,style,insert)
  1633. local Anim={
  1634. Span=lenght;
  1635. Location=insert;
  1636. Count=0;
  1637. Keyframes={}; --Aliases
  1638. Playing=false;
  1639. Loop=false;
  1640. reset_on_loop=true;
  1641. Name=name;
  1642. }
  1643. for i,v in pairs(Joints)do
  1644. Anim.Keyframes[i]=v
  1645. end
  1646. function Anim:Play()
  1647. self.Playing=true
  1648. self.Count=0
  1649. -- anim_script.Disabled=true
  1650. Animation.prev = self
  1651. end
  1652. function Anim:Stop()
  1653. -- if self.reset_on_loop==true then RevertAll() end
  1654. self.Playing=false
  1655. self.Count=0
  1656. -- anim_script.Disabled=false
  1657. -- Animation.prev=nil
  1658. -- RevertAll()
  1659. end
  1660. local Time=tick()
  1661. function Anim:Add(Time,limb,c0,c1)
  1662. if Time>self.Span then error"one simply does not travel to future..."end
  1663. local Tab={TimeOfAction=Time,Joint=limb,frame={C0=c0 or self.Keyframes[limb].n_c0,C1=c1 or self.Keyframes[limb].n_c1}}
  1664. table.insert(self.Keyframes[limb].keys[self.Location],Tab)
  1665. table.sort(self.Keyframes[limb].keys[self.Location],function(a,b) return a.TimeOfAction < b.TimeOfAction end)
  1666. end
  1667. function Anim:Exec(smooth)
  1668. local DT=tick()-Time
  1669. Time=tick()
  1670. local First,Current,Next
  1671. if self.Playing then --Check if anim can play
  1672. self.Count=self.Count+DT --it goes up
  1673. if self.Loop then --Reset when at end if loop
  1674. if self.Count >= self.Span then
  1675. self.Count=0
  1676. if self.onCycle then
  1677. self.onCycle(self)
  1678. end
  1679. end
  1680. elseif not self.Loop then
  1681. if self.Count >= self.Span then
  1682. self.Count=self.Span
  1683.  
  1684. if self.onFinish then
  1685. self.onFinish(self)
  1686. end
  1687. end
  1688. end
  1689. for i,v in pairs(self.Keyframes) do
  1690. if v._can_kf then
  1691. for i2,v2 in pairs(v.keys[self.Location]) do --cframes are stored in joints. self.Location is the name of animation
  1692. First = v.keys[self.Location][1]
  1693. Current = v2
  1694. Next = v.keys[self.Location][i2+1]
  1695. -- print(i2)
  1696. if Next ~= nil and self.Count >= Current.TimeOfAction and self.Count <= Next.TimeOfAction then
  1697. local Dis = (Next.TimeOfAction-Current.TimeOfAction)
  1698. local Perc = (self.Count-Current.TimeOfAction)/Dis
  1699. v.w.C0 = Interpolate(style or 'Linear',Current.frame.C0,Next.frame.C0)(Perc)
  1700. v.w.C1 = Interpolate(style or 'Linear',Current.frame.C1,Next.frame.C1)(Perc)
  1701.  
  1702. v.previous = v.w.C0
  1703.  
  1704. end
  1705. end end
  1706. end
  1707. end
  1708. end
  1709. Animations[name]=Anim
  1710. return Anim
  1711. end
  1712. previous_kfl=nil
  1713. function newAnim(name,lenght,loop,style,strange) --Epic wrapper for epic skids
  1714. NewLimbAnim(name)
  1715. local a=Animation.new(name,lenght,style,name)
  1716.  
  1717. if loop~=nil then
  1718. a.Loop=loop
  1719. end
  1720.  
  1721. return function(kfs)
  1722. if not kfs[0] then
  1723. local t={}
  1724. for j,v in pairs(Joints) do
  1725. t[j]=v.previous
  1726. end
  1727. kfs[0]=t
  1728. end
  1729. a.kfl=kfs
  1730.  
  1731. function a:last()
  1732. local n,o=-1,nil
  1733. for i,v in pairs(self.kfl)do
  1734. if i>n then
  1735. n=i o=v
  1736. if type(o)=='number' then
  1737. o=self.kfl[o]
  1738. end
  1739. end
  1740. end
  1741. return o
  1742. end
  1743. function a:Wait(num)
  1744. repeat wait()until self.Count>=(num or self.Span)
  1745. end
  1746. if lenght==0 then
  1747. for i,v in pairs(kfs) do
  1748. a.Span=i
  1749. end
  1750. end
  1751. for tim,kf in pairs(kfs) do
  1752. local kk=kf
  1753. if type(kf) =='number'then
  1754. kk=kfs[kf]
  1755. end
  1756.  
  1757. for j,v in pairs(kk) do
  1758. if not strange then
  1759. a:Add(tim,j, (v == 0 and Joints[j].n_c0 or (Joints[j].n_c0 * v) ))
  1760. else
  1761. a:Add(tim,j, (v == 0 and Joints[j].n_c0 or v ))
  1762. end
  1763. end
  1764. end
  1765. return a
  1766. end
  1767. end
  1768. local facetick=tick()
  1769. LerParts={}
  1770. function LerParts:Add(tag,part,value,speed)
  1771. local tt = {
  1772. p=part;c=value;s=speed;t=tag;
  1773. }
  1774. function tt:Kill()
  1775. self.p:Destroy()
  1776. LerParts[self.t]=nil
  1777. end
  1778. self[tag]=tt
  1779. end
  1780. RS:BindToRenderStep('Anim',2000,function() --Mainloop
  1781. for i,v in pairs(Animations)do --execute animations
  1782. v:Exec()
  1783. end
  1784.  
  1785. for i,v in pairs(LerParts) do --lerp parts
  1786. if type(v)~='function'then
  1787. v.p.CFrame=v.p.CFrame:lerp(v.c(),v.s)end
  1788. end
  1789.  
  1790. end)
  1791. function tablify(tab)
  1792. setmetatable(tab,{
  1793. __add = function(t,t2)
  1794. if type(t2) ~= 'table' then return end --prevent errors
  1795. local ta={}
  1796. for i,v in pairs(t) do
  1797. ta[i]=v
  1798. end
  1799. for i,v in pairs(t2) do
  1800. ta[i] = v
  1801. end
  1802. return ta
  1803. end
  1804. })
  1805. end
  1806. local init={}
  1807. tablify(init)
  1808. for i,v in pairs(Joints)do
  1809. init[i]=0
  1810. end
  1811. mighty=newAnim('c',1){
  1812. [.1]=init+{t_p=ang(md'-45');
  1813. s_r=ang(md'45',0,md'75');
  1814. s_l=ang(md'45',0,md'-75');
  1815. a_r=ang(md'25');
  1816. a_l=ang(md'25');
  1817. }
  1818. }
  1819.  
  1820. armraise=newAnim('a',.5){
  1821. [0]=init;
  1822. [.25]={
  1823. s_r=ang(md'90');
  1824. };
  1825. [.5]={
  1826. h_r=ang(md'75');
  1827. };
  1828. }
  1829. push=newAnim('a2',.25){
  1830. [0]=init+{
  1831. s_r=ang(md'90');
  1832. h_r=ang(md'75');
  1833. };
  1834. [.25]={
  1835. s_r=ang(md'90');
  1836. a_r=ang(md'45');
  1837. e_r=ang(md'15');
  1838. };
  1839. }
  1840. function laser(st,en,r)
  1841. total_mag=(st-en).magnitude
  1842. prev=cfn(st)
  1843. local mo=New"Model"{_P=Main}
  1844. set_parent=mo
  1845. local pm={-1,1}
  1846. for i=0,1,.1 do
  1847. local pos=cfn(st):lerp(cfn(en),i)
  1848. local pos2=pos*cfn(pm[mr(#pm)]*r,0,pm[mr(#pm)]*r)
  1849. local mag=(prev.p-pos2.p).magnitude
  1850. local laz=Part(.1,mag,.1,'Really red',.5)_1.Anchored=true _1.Material='Neon'
  1851. Mesh(_1,'bl',.5,1,.5)
  1852. _1.CFrame=(cfn(prev.p,pos2.p)*cfn(0,0,-mag/2))*ang(PI/2)
  1853. if i>.9 then
  1854. _1.CFrame=(cfn(prev.p,pos2.p)*cfn(0,0,-mag/2))*ang(PI/2)
  1855. end
  1856. prev=pos2
  1857. end
  1858. set_parent=nil
  1859. DEBRIS:AddItem(mo,.025)
  1860. end
  1861.  
  1862. function sparks()
  1863. local a=newAnim('sfss',2.1){
  1864. [0]=init;
  1865. [.25]={
  1866. s_r=ang(md'100',md'-25');
  1867. a_r=ang(0,0,md'-25');
  1868. h_r=ang(md'-10');
  1869.  
  1870. s_l=ang(md'80',md'25');
  1871. a_l=ang(0,0,md'25');
  1872. h_l=ang(md'-10',PI);
  1873.  
  1874. e_r=ang(md'-5');
  1875. e_l=ang(md'5');
  1876. };
  1877. [.75]={
  1878. e_r=ang(md'25');
  1879. e_l=ang(md'-25');
  1880. };
  1881. [2]=.75;
  1882. [2.1]={
  1883. e_r=ang(md'-5');
  1884. e_l=ang(md'5');
  1885. };
  1886. }a:Play()
  1887. a:Wait(.25)
  1888. changeFace('happy')
  1889. local p=Part(1,1,1,Robot.Color2)_1.Material='Neon'_1.Anchored=true
  1890. p.CFrame=heart_r.CFrame:lerp(heart_l.CFrame,.5)
  1891. 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)
  1892. -- Spawn(function()
  1893. repeat
  1894. laser(heart_r.Position,heart_l.Position,.25)
  1895. for i,v in pairs(findHum(torso.Position,30))do
  1896. if v~=human then
  1897. v.Torso.Velocity=cfn(v.Torso.Position,torso.Position).lookVector*20
  1898. v.Torso.RotVelocity=v3n(0,100,0)
  1899. end end
  1900. wait()
  1901. until a.Count>=2
  1902. changeFace('normal')
  1903. LerParts['orb']:Kill()
  1904. local ring=Part(1,1,1,'Really red',.5)_1.Anchored=true
  1905. local msh=Mesh(_1,mesh_ids.ring)
  1906. ring.CFrame=cfn(heart_r.CFrame:lerp(heart_l.CFrame,.5).p)*ang(PI/2,0,0)
  1907. for i=0,1,.1 do
  1908. msh.Scale=v3n(i*20,i*20,1)
  1909. ring.Transparency=.5+i*.5
  1910. wait()
  1911. end
  1912. ring:Destroy()
  1913. a:Wait()a:Stop()
  1914. reset()
  1915. -- end)
  1916.  
  1917. end
  1918. -- o=newAnim("werwer",.5){
  1919. -- [0]=init;
  1920. -- [.1]={
  1921. -- t_p=ang(md'15',md'25');
  1922. -- s_l=ang(md'45');
  1923. -- s_r=ang(md'45');
  1924. -- };
  1925. -- [.5]={
  1926. -- t_p=ang(md'-15',md'-25');
  1927. -- s_l=ang(md'140',0,md'75');
  1928. -- s_r=ang(md'140',0,md'75');
  1929. -- h_r=ang(0,PI/2);
  1930. -- a_l=0;
  1931. -- };
  1932. -- }o:Play()o:Wait()
  1933. -- o.Playing=false
  1934. -- o:Stop()
  1935. -- o2=newAnim('ww',.5,true){
  1936. -- [0]=o:last();
  1937. -- [.2]={
  1938. -- t_p=ang(md'15',md'25');
  1939. -- s_l=ang(md'45',0,md'75');
  1940. -- s_r=ang(md'45',0,md'75');
  1941. -- a_l=ang(md'-15',md'15')
  1942. -- };
  1943. -- [.5]=0
  1944. -- }o2:Play()
  1945.  
  1946. function reset()
  1947. local cc=newAnim('sfs',.5,false,_,true){
  1948. [.5]=init;
  1949. }cc:Play()cc:Wait()cc:Stop()
  1950. end
  1951. human.Died:connect(function() --onDeath
  1952. e=Instance.new("Explosion",Workspace)
  1953. e.Position=torso.Position
  1954. e.BlastRadius=30
  1955. end)
  1956. function beam()
  1957. armraise.Count=0
  1958. armraise:Play()
  1959. armraise:Wait()
  1960.  
  1961. for i=1,30 do
  1962. local bl=Part(.1,.1,.1,'Really red',.5)
  1963. _1.Material='Neon'
  1964. _1.CFrame=l(heart_r,mr(-3,3),mr(-3,3))
  1965. Mesh(_1,'s')
  1966. New"BodyPosition"{_P=bl;position=heart_r.Position}
  1967. DEBRIS:AddItem(bl,.3)
  1968. wait()
  1969. end
  1970.  
  1971. local obj,pos=Workspace:FindPartOnRay(Ray.new(l(heart_r).p,l(heart_r).lookVector*100),character)
  1972. if obj and pos then
  1973. changeFace("xD")
  1974. local mag = (l(heart_r).p-pos).magnitude
  1975. local laz=Part(1,mag,1,'Really red')_1.Anchored=true
  1976. local msh=Mesh(laz,'cyl')
  1977. local lista={}
  1978. laz.CFrame=(cfn(l(heart_r).p,pos)*cfn(0,0,-mag/2))*ang(PI/2)
  1979.  
  1980. for i,v in pairs(findHum(pos,10))do
  1981. if v~=human then
  1982. v.Health=0 end
  1983. end
  1984.  
  1985. for i=0,1,1/4 do
  1986. local r=Part(1,1,1,'Really red',.5)_1.Anchored=true
  1987. r.CFrame=l(laz,0,-laz.Size.y/2+laz.Size.y*i,0,PI/2)
  1988. local msh=Mesh(r,mesh_ids.ring)
  1989. table.insert(lista,r)
  1990. end
  1991.  
  1992. local ss=mesh_scales.ring*v3n(laz.Size.x,laz.Size.z,1)
  1993. Spawn(function()
  1994. for i=0,1,.05 do
  1995. Edit{msh,laz}{Transparency=i;Scale=v3n(1+i*3,1,1+i*3)}
  1996. Edit(lista){Transparency=i;['Mesh.Scale']=ss+v3n(i*10,i*10,1)}
  1997. wait()
  1998. end
  1999. laz:Destroy()
  2000. for i,v in pairs(lista)do v:Destroy()end
  2001. end)
  2002. end
  2003. push:Play()
  2004. push:Wait()
  2005. push:Stop()
  2006. armraise:Stop()
  2007. changeFace('normal')
  2008. reset()
  2009. end
  2010. Mouse=player:GetMouse()
  2011. atacking=false
  2012. mouse_con1=Mouse.KeyDown:connect(function(key)
  2013. attacking=true
  2014.  
  2015. if key=='f'then
  2016. beam()
  2017. elseif key=='r'then
  2018. sparks()
  2019. end
  2020.  
  2021. attacking=false
  2022. end)
  2023. --Maeking sure it wont go insane--
  2024. New"BindableFunction"{_P=script;Name='sidos'}.OnInvoke=function()
  2025. mouse_con1:disconnect()
  2026. end
  2027. script.Name='riimu'
  2028.  
  2029. z = Instance.new("Sound", hole)
  2030. z.SoundId = "rbxassetid://162701939" -- Put Music ID Here.
  2031. z.Looped = true
  2032. z.Volume = 2
  2033. wait(.1)
  2034. z:Play()
  2035.  
  2036. Robot = {}
  2037. Robot.Name = "EvilMachine"
  2038. Robot.Health=100
  2039. Robot.Scale=1
  2040. Robot.Color = "Really black"
  2041. Robot.Color2 = "Really red"
  2042. --declarations
  2043. PI=math.pi
  2044. TAU=PI*2
  2045. DEBRIS=game:service'Debris'
  2046. mr,md=math.random,math.rad
  2047. cfn,v3n=CFrame.new,Vector3.new
  2048. _A=nil
  2049. ang=function(x,y,z)local a=CFrame.Angles(x or 0,y or 0,z or 0)_A=a return a end
  2050. RS=game:service'RunService'
  2051. bcol=BrickColor.new
  2052. RS:UnbindFromRenderStep('Anim')
  2053. --player specific...
  2054. player = game.Players.LocalPlayer
  2055. character = player.Character
  2056. torso = character.Torso
  2057. head = character.Head
  2058. rarm = character['Right Arm']
  2059. larm = character['Left Arm']
  2060. rleg = character['Right Leg']
  2061. rleg = character['Left Leg']
  2062. human = character.Humanoid
  2063. --Utilities... who needs them?
  2064. function findHum(pos,rad,hum2)
  2065. local hums={}
  2066. function check(a)
  2067. local res=false
  2068. for i,ho in pairs(hums)do
  2069. if a==ho then res=true end
  2070. end
  2071. return res
  2072. end
  2073. for i,v in pairs(Workspace:children())do
  2074. if v:IsA'Model'and v~=Char and v~=(hum2 or Char) then
  2075. for i,q in pairs(v:children())do
  2076. if q:IsA'Humanoid' and q.Parent:FindFirstChild'Torso'and(q.Torso.Position-pos).magnitude < rad then
  2077. if not check(q)then
  2078. table.insert(hums,q)
  2079. end
  2080. end
  2081. end
  2082. end
  2083. end
  2084. return hums
  2085. end
  2086. function checkY(p1,p2,range,range2)
  2087. local function checko()
  2088. 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) )
  2089. end
  2090. if range2 then
  2091. return (l(p1).Y > l(p2).Y-range and l(p2).Y < l(p2).Y+range) and checko()
  2092. else
  2093. return (l(p1).Y > l(p2).Y-range and l(p2).Y < l(p2).Y+range)
  2094. end
  2095. end
  2096. udim=function(a,b,c,d)
  2097. if type(a)=='string'then
  2098. x,y=tostring(a):match('([%+%d%.%-%/%*]+),([%+%d%.%-%/%*]+)')
  2099. return UDim2.new(x or 0,x2 or 0,y or 0,y2 or 0)
  2100. else
  2101. return UDim2.new(a or 0,c or 0,b or 0,d or 0)
  2102. end end
  2103. function l(a1,x,y,z,rx,ry,rz)
  2104. local cf
  2105. if tostring(a1):find(',') == nil then
  2106. cf=a1.CFrame
  2107. else cf=a1 end
  2108. return cf*CFrame.new(x or 0,y or 0,z or 0)*CFrame.Angles(
  2109. rx or 0,ry or 0,yz or 0)
  2110. end
  2111. function f(a) --turns thigns in to function returning the thing... f(l)(torso,0,2,0)
  2112. return function(...)
  2113. local args={...}
  2114. return function() return a(unpack(args)) end
  2115. end
  2116. end
  2117. function isIn(what,tab) --returns true if what is in tab. isIn("Troll", {"Tomato", "Troll", "Strawberry") --> true
  2118. local res=false
  2119. for i,v in next,tab do
  2120. if v==what then
  2121. res = true
  2122. break
  2123. end
  2124. end
  2125. return res
  2126. end
  2127. Weld = function(part0,part1,c0,c1,...) --over-engineered welding function which accepts many things
  2128. local ar = {...}
  2129. local cframe0,cframe1
  2130. local function checkf()local res=true
  2131. for i,v in pairs(ar)do
  2132. if type(v) ~= 'number' then
  2133. res=false
  2134. end
  2135. end
  2136. return res
  2137. end
  2138. if type(c0) == 'table' then
  2139. cframe0 = CFrame.new(c0[1] or 0, c0[2] or 0, c0[3] or 0) * CFrame.Angles(
  2140. c0[4] or 0, c0[5] or 0, c0[6] or 0)
  2141. elseif type(c0) == 'userdata' then
  2142. cframe0 = c0
  2143. elseif type(c0) == 'number' and checkf() then
  2144. 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)
  2145. end
  2146. if type(c1) == 'table' then
  2147. cframe1 = CFrame.new(c1[1] or 0, c1[2] or 0, c1[3] or 0) * CFrame.Angles(
  2148. c1[4] or 0, c1[5] or 0, c1[6] or 0)
  2149. elseif type(c1) == 'userdata' then
  2150. cframe1 = c1
  2151. elseif type(c1) == 'number' and (not c0 or (c0 and type(c0) == 'table')) then
  2152. 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)
  2153. end
  2154. for i,v in pairs(ar)do
  2155. if type(v) == 'table' then
  2156. 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)
  2157. elseif type(v) == 'userdata' then
  2158. cframe1 = v
  2159. end
  2160. end
  2161.  
  2162. cframe0,cframe1 = cframe1,cframe0
  2163. part0.Position=part1.Position
  2164. local weld = Instance.new("Weld")
  2165. weld.Part0 = part0
  2166. weld.Part1 = part1
  2167. weld.C0 = cframe0 or CFrame.new()
  2168. weld.C1 = cframe1 or CFrame.new()
  2169. if weld:IsA'Motor'then weld.MaxVelocity = set_maxvel or .1 end
  2170. weld.Parent = part0
  2171. _2=weld
  2172. return weld
  2173. end
  2174. mesh_ids = {
  2175. spikeball = "rbxassetid://0";
  2176. spike = "rbxassetid://0";
  2177. ring = "rbxassetid://0";
  2178. coil = 'rbxassetid://0';
  2179. diamond = 'rbxassetid://0';
  2180. rock = 'rbxassetid://0';
  2181. gear = 'rbxassetid://0';
  2182. crown = 'rbxassetid://0';
  2183. orb = 'rbxassetid://0';
  2184. heart = 'rbxassetid://0';
  2185. dragon = 'rbxassetid://0';
  2186. }
  2187. mesh_texs = {
  2188. rock = 'rbxassetid://1290030';
  2189. dragon = 'rbxassetid://25665033';
  2190. }
  2191. mesh_scales={
  2192. diamond = v3n(0.75, 0.75, 0.75);
  2193. spikeball = v3n(1.05, 1.05, 1.05);
  2194. spike = v3n(0.5, 1.5, 0.5);
  2195. gear = v3n(1.25,1.25,18);
  2196. ring = v3n(1, 1, 6);
  2197. coil = v3n(0.5, 0.5, 0.3);
  2198. crown = v3n(0.6, 0.6, 0.6);
  2199. orb = v3n(1, 1, 1);
  2200. heart = v3n(0.25, 0.25, 0.4);
  2201. dragon = v3n(0.4, 0.5, 0.4);
  2202. }
  2203. mesh_offsets={
  2204. crown = v3n(0,.15,0);
  2205. }
  2206. function bindMesh(mesh,Size)
  2207. local mesh_name
  2208. local size=Size or mesh.Parent.Size
  2209. for name,id in next,mesh_ids do
  2210. if mesh.MeshId==id then
  2211. mesh_name=name
  2212. end
  2213. end
  2214. if not mesh_name then return end
  2215. local mesh=mesh
  2216. local con
  2217. con=mesh.Parent.Changed:connect(function()
  2218. local siz=mesh.Parent.Size
  2219. mesh.Scale=siz*mesh_scales[mesh_name]
  2220. if mesh_offsets[mesh_name] then
  2221. mesh.Offset=siz*mesh_offsets[mesh_name]
  2222. end
  2223. end)
  2224. return con
  2225. end
  2226. Mesh = function(parent,id,sx,sy,sz)
  2227. local name = ( (id == 'cyl' and 'CylinderMesh') or (id == 'bl' and 'BlockMesh') or 'SpecialMesh')
  2228. local mesh = Instance.new(name)
  2229. if id == 's' then
  2230. mesh.MeshType = Enum.MeshType.Sphere
  2231. elseif id == 'w' then
  2232. mesh.MeshType = Enum.MeshType.Wedge
  2233. elseif id == 'h' then
  2234. mesh.MeshType = Enum.MeshType.Head
  2235. elseif string.find(id,"://") ~= nil then
  2236. mesh.MeshId = id
  2237. end
  2238. mesh.Scale = Vector3.new(sx or 1, sy or 1, sz or 1)
  2239. mesh.Parent = parent
  2240. _3=mesh
  2241. return mesh
  2242. end
  2243. Edit = function(what)
  2244. return function(args)
  2245. for ind,obj in next,what do
  2246. for arg,val in next,args do
  2247. local child,argu = arg:match"(.+)%.(.+)"
  2248. if child and argu then
  2249. if pcall(function()return obj[child][argu] end) then
  2250. obj[child][argu]=val
  2251. end
  2252. else
  2253. if arg=='_F'then
  2254. val(ind,obj)
  2255. elseif pcall(function()return obj[arg]end) then
  2256. obj[arg]=val
  2257. end
  2258. end
  2259. end
  2260. end
  2261. end
  2262. end
  2263. New = function(what) --Synthetic caffeine for Instance.new
  2264. local obj
  2265. if type(what) ~= 'string' then
  2266. obj=what:Clone()
  2267. else
  2268. obj=Instance.new(what)
  2269. end
  2270. if what=='Weld' then obj.Name='mujoint'end
  2271. return function(bar)
  2272. for arg,val in pairs(bar) do
  2273. if arg == "_P" then
  2274. obj.Parent = val
  2275. elseif arg=="_PP" then
  2276. obj.Part0=val[1]
  2277. obj.Part1=val[2]
  2278. elseif arg=='_F'then
  2279. val(obj)
  2280. else
  2281. if pcall(function()return obj[arg] end) then
  2282. obj[arg]=val
  2283. end
  2284. end
  2285. end _4=obj
  2286. return obj
  2287. end
  2288. end
  2289. set_parent,set_material=nil,nil
  2290. set_maxvel,set_anchor=nil,nil
  2291. _1,_2,_3,_4,_5,_6,_7,_8 = nil,nil,nil,nil,nil,nil,nil
  2292. Part = function(x,y,z,col,tr)
  2293. local p = New"Part"{
  2294. _P=set_parent or ears or Main;
  2295. BrickColor = BrickColor.new(col or set_color or "Really black");
  2296. CanCollide = false;
  2297. Transparency = tr or 0;
  2298. Size = Vector3.new(x or 0,y or 0,z or 0);
  2299. Material = set_material or 'SmoothPlastic';
  2300. Anchored = (set_anchor~=nil and set_anchor or false)
  2301. }
  2302. for _,sur in next,Enum.NormalId:GetEnumItems() do
  2303. p[sur.Name..'Surface'] = 10
  2304. end
  2305. _1 = p
  2306. return p
  2307. end
  2308. Joints={}
  2309. Joint={}
  2310. Joint.new=function(name,weld,c0,c1)
  2311. local joint={
  2312. w=weld;
  2313. part1=weld.Part1;
  2314. n_c0=(c0 or weld.C0);
  2315. n_c1=(c1 or weld.C1);
  2316. name=name;
  2317. previous=weld.C0;
  2318. _can_kf=true;
  2319. }
  2320. joint.keys={};
  2321. function joint:revertToOrig()
  2322. self.w.C0=self.n_c0
  2323. self.w.C1=self.n_c1
  2324. end
  2325. function joint:NewAnim(anim)
  2326. self.keys[anim]={}
  2327. end
  2328. setmetatable(joint,{
  2329. __mul=function(ta,val)
  2330. return ta.n_c0*val
  2331. end;
  2332. })
  2333. getfenv()[name]=joint
  2334. Joints[name]=joint
  2335. return joint
  2336. end
  2337. pcall(function() character[Robot.Name]:Destroy() end) --removes old model.
  2338. pcall(function()character.Head.face.Transparency=1 end)
  2339. Main = New"Model"{_P=character;Name = Robot.Name}
  2340. for i,v in pairs(character:children())do
  2341. if v:IsA'Hat'then v.Handle.Transparency=1
  2342. elseif v:IsA'Part'then
  2343. v.Transparency=1 end
  2344. end
  2345. --Torso...
  2346. midp=Part(4,1.5,2)_1.Transparency=1
  2347. Weld(midp,torso)
  2348. bottomp=Part(2,1.5,1.5,_,1)
  2349. Joint.new('b_p',Weld(bottomp,midp,0,-.75))
  2350. --Cage--
  2351. back_wall=Part(2,1.5,.25)
  2352. Weld(_1,bottomp,0,0,.75-.125)
  2353. front_wall=Part(2,1.25,.25)
  2354. -- Weld(_1,bottomp,0,0,-.75-.125)
  2355. cabin_mot=New"Motor"{_P=front_wall;_PP={front_wall,bottomp};
  2356. C1=cfn(0,.75,-.75+.125)*ang(0,PI/2);C0=cfn(0,1.25/2,0)*ang(0,PI/2);
  2357. MaxVelocity=.1}
  2358. -- Spawn(function() --demonstration of secret cabinet
  2359. -- while wait(1)do
  2360. -- cabin_mot.DesiredAngle=PI/2
  2361. -- wait(1)
  2362. -- cabin_mot.DesiredAngle=0
  2363. -- end end)
  2364. bottom_wall=Part(2,.25,1.5)
  2365. Weld(bottom_wall,bottomp,0,-.75+.125)
  2366. --Sides
  2367. p=Part(1.5,1.5,.75)Mesh(p,'w')
  2368. Weld(p,bottomp,-1-.75/2,0,0,PI,PI/2)
  2369. p=Part(1.5,1.5,.75)Mesh(p,'w')
  2370. Weld(p,bottomp,1+.75/2,0,0,PI,-PI/2)
  2371. topp=Part(4,1.5,2)
  2372. -- Weld(topp,bottomp,0,1.5)
  2373. Joint.new('t_p',New"Weld"{_P=topp;_PP={topp,bottomp};C1=cfn(0,.75,0);C0=cfn(0,-.75,0)})
  2374. --head
  2375. hed=Part(1,1,1)
  2376. Weld(hed,topp,0,.75+.5)
  2377. for _,v in pairs{ {.55,0};{-.55,PI} } do
  2378. local p=Part(.35,.1,.35)Mesh(_1,'cyl')
  2379. Weld(_1,hed,v[1],.235,0,0,v[2],PI/2)
  2380. local p2=Part(.35,.1,.35)Mesh(p2,'s')
  2381. Weld(p2,p,0,-.05)
  2382. local cyl=Part(.1,.25,.1)
  2383. Mesh(_1,'cyl',.5,1,.5)
  2384. Weld(cyl,p,.35/2+(.25/2-.05),-.025,0,PI/2,0,PI/2)
  2385. local cyl2=Part(.1,.25,.1)
  2386. Mesh(_1,'cyl',.25,1/2,.25)
  2387. Weld(cyl2,cyl,0,-.125-(.125/2))
  2388. local cyl3=Part(.1,.25,.1)
  2389. Mesh(_1,'cyl',.125,1/2,.125)
  2390. Weld(cyl3,cyl2,0,-.25/2)
  2391. end
  2392. --Faces--
  2393. faces={}
  2394. 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]]"
  2395. 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]]"
  2396. 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]]"
  2397. 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]]"
  2398. 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]]"
  2399. 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]]"
  2400. 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]]"
  2401. htp=game:service'HttpService'
  2402. bitmap=htp:JSONDecode(faces.normal)
  2403. surfg=New"SurfaceGui"{_P=hed;Face='Front';Size=udim'1,1'}
  2404. fr=New"Frame"{_P=surfg;Size=udim'1,1';BackgroundTransparency=1}
  2405. for y=1,10 do
  2406. for x=1,10 do
  2407. local f=New"Frame"{_P=fr;Size=udim(1/10,1/10);Position=udim( (-1+x)*1/10,(-1+y)*1/10 );
  2408. BackgroundColor=bcol(Robot.Color2);BackgroundTransparency=1;
  2409. }
  2410. for _,v in pairs(bitmap) do
  2411. if v[1] and v[2] then
  2412. if x-1==v[1] and y-1==v[2] then
  2413. f.BackgroundTransparency=0
  2414. end
  2415. end
  2416. end
  2417. -- if bitmap[y][x] ~= nil and bitmap[y][x]==1 then
  2418. -- f.BackgroundTransparency=0
  2419. -- end
  2420. end
  2421. end
  2422. function changeFace(face)
  2423. local bitmap=htp:JSONDecode(faces[face])
  2424. fr:ClearAllChildren()
  2425. for y=1,10 do
  2426. for x=1,10 do
  2427. -- print(x,y)
  2428. f=New"Frame"{_P=fr;Size=udim(1/10,1/10);Position=udim( (-1+x)*1/10,(-1+y)*1/10 );
  2429. BackgroundColor=bcol(Robot.Color2);BackgroundTransparency=1;
  2430. }
  2431. for _,v in pairs(bitmap) do
  2432. if v[1] and v[2] then
  2433. if x-1==v[1] and y-1==v[2] then
  2434. f.BackgroundTransparency=0
  2435. end
  2436. end
  2437. end
  2438. end
  2439. end
  2440. prevface=faces[face]
  2441. end
  2442. ----
  2443. --Health display
  2444. function newseg(le,x,y,z,rx,ry,rz)
  2445. local segment={}
  2446. segment.modl=New"Model"{_P=Main;Name='Segment'}
  2447. set_parent=segment.modl
  2448. le=le or .5
  2449. local p=Part(le,.1,.1,'Really red')Mesh(p,'bl',1,.5,.1)
  2450. Weld(p,bgp,x,y,z,rx,ry,rz)
  2451. local p2=Part(.1,.1,.1,'Really red')Mesh(p2,'bl',.35,.35,.1)
  2452. Weld(p2,p,le/2,0,0,0,0,PI/4)
  2453. local p22=Part(.1,.1,.1,'Really red')Mesh(p22,'bl',.35,.35,.1)
  2454. Weld(p22,p,-le/2,0,0,0,0,PI/4)
  2455.  
  2456. Edit{p,p2,p22}{Material='Neon';Transparency=1}
  2457.  
  2458. function segment:light(a)
  2459. for i,v in pairs(self.modl:children())do
  2460. v.BrickColor=bcol'Really red'
  2461. v.Material='Neon'
  2462. v.Transparency=a or 0
  2463. end
  2464. end
  2465.  
  2466. function segment:dim(a)
  2467. for i,v in pairs(self.modl:children())do
  2468. v.BrickColor=bcol'Hurricane rgey'
  2469. v.Material='SmoothPlastic'
  2470. v.Transparency=.9
  2471. end
  2472. end
  2473. set_parent=nil
  2474.  
  2475. return segment
  2476. end
  2477. letters = {
  2478. [0]='1111110';[1]='0110000';[2]='1101101';[3]='1111001';[4]='0110011';[5]='1011011';
  2479. [6]='1011111';[7]='1110000';[8]='1111111';[9]='1111011';
  2480. ['A']='1110111';['b']='0011111';['C']='1001110';['d']='0111101';['E']='1001111';['F']='1000111'
  2481. }
  2482. function new7Dig(x,y,z,rx,ry,rz)
  2483. local disp = {}
  2484. disp.segs={}
  2485.  
  2486. bgp=Part(.75,1,.1,'Black')
  2487. Weld(bgp,topp,x,y,z,rx,ry,rz)
  2488.  
  2489. disp.segs[1]=newseg(_,0,.4,-.1) --top
  2490. disp.segs[6]=newseg(.25,.75*.4,.2,-.1,0,0,PI/2) --second top
  2491. disp.segs[2]=newseg(.25,-.75*.4,.2,-.1,0,0,PI/2)
  2492.  
  2493. disp.segs[7]=newseg(_,0,0,-.1) --middle
  2494. disp.segs[5]=newseg(.25,.75*.4,-.2,-.1,0,0,PI/2) --second bottom
  2495. disp.segs[3]=newseg(.25,-.75*.4,-.2,-.1,0,0,PI/2)
  2496.  
  2497. disp.segs[4]=newseg(_,0,-.4,-.1) --bottom
  2498.  
  2499. function disp:show(letter)
  2500. for i,v in pairs(disp.segs)do
  2501. v:dim()
  2502. end
  2503. local str=letters[tonumber(letter)]
  2504. for i=1,7 do
  2505. -- print(i)
  2506. local s=str:sub(i,i)
  2507. if s=='1' then
  2508. self.segs[i]:light()
  2509. end
  2510. end
  2511. end
  2512. return disp
  2513. end
  2514. D2=new7Dig(0,0,-1.05)
  2515. D=new7Dig(.75,0,-1.05)
  2516. D3=new7Dig(-.75,0,-1.05)
  2517. local prevhp=99
  2518. prevface=faces.normal
  2519. human.HealthChanged:connect(function(hp)
  2520. local str=tostring(math.floor(hp))
  2521. if #str==3 then
  2522. D:show(str:sub(1,1))
  2523. D2:show(str:sub(2,2))
  2524. D3:show(str:sub(3,3))
  2525. elseif #str==2 then
  2526. D:show(0)
  2527. D2:show(str:sub(1,1))
  2528. D3:show(str:sub(2,2))
  2529. elseif #str==1 then
  2530. D:show(0)
  2531. D2:show(0)
  2532. D3:show(str:sub(1,1))
  2533. end
  2534. end)
  2535. human.Health=99
  2536. ----
  2537. --Right arm...
  2538. s=Part(1.25,1.25,1.25)
  2539. Joint.new('s_r',New"Motor"{_P=s;_PP={s,topp};C1=cfn(3-.625,.75,0)*ang(0,PI)})
  2540. a1=Part(1,1.5,1)
  2541. Joint.new('e_r',New"Motor"{_P=a1;_PP={a1,s};C1=cfn(0,-1.25/2,0);C0=cfn(0,.75,0)})
  2542. a2=Part(1,1.5,1,_,.5)
  2543. Joint.new('a_r',New"Motor"{_P=a1;_PP={a2,a1};C1=cfn(0,-.75,0);C0=cfn(0,.75,0)})
  2544. --Another secret cabinet
  2545. cabin_mot.DesiredAngle=PI/2
  2546. front_wall=Part(1,1.4,.1)
  2547. Weld(_1,a2,0,-.05,.5-.1)
  2548. back_wall=Part(1,1.4,.1)
  2549. Weld(_1,a2,0,-.05,-.5+.1)
  2550. top_wall=Part(1,.1,1,'Black')
  2551. Weld(top_wall,a2,0,.75-.05)
  2552. local hand_r=Part(1.1,.75,.5)
  2553. Joint.new('h_r',New"Motor"{_P=hand_r;_PP={hand_r,a2};C1=cfn(0,-.75,0);C0=cfn(0,.75/2,0)})
  2554. local heart_r=Part(.5,.5,.1,Robot.Color2)
  2555. Weld(_1,hand_r,0,0,-.25)
  2556. --Left arm...
  2557. s=Part(1.25,1.25,1.25)
  2558. Joint.new('s_l',New"Motor"{_P=s;_PP={s,topp};C1=cfn(-(3-.625),.75,0)*ang(0,PI)})
  2559. a1=Part(1,1.5,1)
  2560. Joint.new('e_l',New"Motor"{_P=a1;_PP={a1,s};C1=cfn(0,-1.25/2,0);C0=cfn(0,.75,0)})
  2561. a2=Part(1,1.5,1)
  2562. Joint.new('a_l',New"Motor"{_P=a1;_PP={a2,a1};C1=cfn(0,-.75,0);C0=cfn(0,.75,0)})
  2563. hand_l=Part(1.1,.75,.5)
  2564. Joint.new('h_l',New"Motor"{_P=hand_l;_PP={hand_l,a2};C1=cfn(0,-.75,0);C0=cfn(0,.75/2,0)})
  2565. heart_l=Part(.5,.5,.1,Robot.Color2)
  2566. Weld(_1,hand_l,0,0,-.25)
  2567. human.HipHeight=3
  2568. hole=Part(1.25*.8,.1,1.25*.8,'Black')
  2569. local partata = New"ParticleEmitter"{_P=hole;}
  2570. partata.Size = NumberSequence.new(30,2,1)
  2571. partata.Speed = NumberRange.new (-4)
  2572. partata.Lifetime = NumberRange.new (1)
  2573. partata.Texture = "http://www.roblox.com/asset/?id=254711773"
  2574. partata.Color = ColorSequence.new(Color3.new(0, 0, 0),Color3.new(0, 0, 0))
  2575. Weld(hole,bottomp,0,-.8)
  2576. Mesh(hole,'cyl')
  2577. --EAsings--
  2578. Styles={
  2579. Linear = function(alpha)
  2580. return alpha
  2581. end;
  2582. easeInSine = function(alpha)
  2583. local alpha = (1-math.cos(alpha*(math.pi/2)))
  2584. return alpha
  2585. end;
  2586. easeOutSine = function(alpha)
  2587. alpha = math.sin(alpha*(math.pi/2))
  2588. return alpha
  2589. end;
  2590. easeInOutSine = function(alpha)
  2591. alpha = alpha*2
  2592. if alpha < 1 then
  2593. return 0.5*Styles["easeInSine"](alpha)
  2594. else
  2595. return 0.5*Styles["easeOutSine"](alpha-1)+.5
  2596. end
  2597. end;
  2598.  
  2599. easeInQuadratic = function(alpha)
  2600. alpha = alpha^2
  2601. return alpha
  2602. end;
  2603. easeOutQuadratic = function(alpha)
  2604. _alpha = 1-alpha
  2605. alpha = 1-_alpha*_alpha
  2606. return alpha
  2607. end;
  2608. easeInOutQuadratic = function(alpha)
  2609. alpha = alpha*2
  2610. if alpha < 1 then
  2611. return 0.5*Styles["easeInQuadratic"](alpha)
  2612. else
  2613. return 0.5*Styles["easeOutQuadratic"](alpha-1)+0.5
  2614. end
  2615. end;
  2616.  
  2617. easeInCubic = function(alpha)
  2618. alpha = alpha^3
  2619. return alpha
  2620. end;
  2621. easeOutCubic = function(alpha)
  2622. alpha = 1-alpha
  2623. return 1-alpha^3
  2624. end;
  2625. easeInOutCubic = function(alpha)
  2626. alpha = alpha*2
  2627. if alpha < 1 then
  2628. return 0.5*Styles["easeInCubic"](alpha)
  2629. else
  2630. return 0.5*Styles["easeOutCubic"](alpha-1)+.5
  2631. end
  2632. end;
  2633. }
  2634. function Interpolate(Type,p0,p1)
  2635. local Data = {Style = Styles[Type],PointA = p0,PointB = p1}
  2636. return function(Perc)
  2637. local Perc = Data.Style(Perc)
  2638. return Data.PointA:lerp(Data.PointB,Perc)
  2639. end
  2640. end
  2641. function NewLimbAnim(anim)
  2642. for _,v in pairs(Joints)do
  2643. v:NewAnim(anim)
  2644. end
  2645. end
  2646. Animations={}
  2647. Animation={prev=nil}
  2648. function Animation.new(name,lenght,style,insert)
  2649. local Anim={
  2650. Span=lenght;
  2651. Location=insert;
  2652. Count=0;
  2653. Keyframes={}; --Aliases
  2654. Playing=false;
  2655. Loop=false;
  2656. reset_on_loop=true;
  2657. Name=name;
  2658. }
  2659. for i,v in pairs(Joints)do
  2660. Anim.Keyframes[i]=v
  2661. end
  2662. function Anim:Play()
  2663. self.Playing=true
  2664. self.Count=0
  2665. -- anim_script.Disabled=true
  2666. Animation.prev = self
  2667. end
  2668. function Anim:Stop()
  2669. -- if self.reset_on_loop==true then RevertAll() end
  2670. self.Playing=false
  2671. self.Count=0
  2672. -- anim_script.Disabled=false
  2673. -- Animation.prev=nil
  2674. -- RevertAll()
  2675. end
  2676. local Time=tick()
  2677. function Anim:Add(Time,limb,c0,c1)
  2678. if Time>self.Span then error"one simply does not travel to future..."end
  2679. local Tab={TimeOfAction=Time,Joint=limb,frame={C0=c0 or self.Keyframes[limb].n_c0,C1=c1 or self.Keyframes[limb].n_c1}}
  2680. table.insert(self.Keyframes[limb].keys[self.Location],Tab)
  2681. table.sort(self.Keyframes[limb].keys[self.Location],function(a,b) return a.TimeOfAction < b.TimeOfAction end)
  2682. end
  2683. function Anim:Exec(smooth)
  2684. local DT=tick()-Time
  2685. Time=tick()
  2686. local First,Current,Next
  2687. if self.Playing then --Check if anim can play
  2688. self.Count=self.Count+DT --it goes up
  2689. if self.Loop then --Reset when at end if loop
  2690. if self.Count >= self.Span then
  2691. self.Count=0
  2692. if self.onCycle then
  2693. self.onCycle(self)
  2694. end
  2695. end
  2696. elseif not self.Loop then
  2697. if self.Count >= self.Span then
  2698. self.Count=self.Span
  2699.  
  2700. if self.onFinish then
  2701. self.onFinish(self)
  2702. end
  2703. end
  2704. end
  2705. for i,v in pairs(self.Keyframes) do
  2706. if v._can_kf then
  2707. for i2,v2 in pairs(v.keys[self.Location]) do --cframes are stored in joints. self.Location is the name of animation
  2708. First = v.keys[self.Location][1]
  2709. Current = v2
  2710. Next = v.keys[self.Location][i2+1]
  2711. -- print(i2)
  2712. if Next ~= nil and self.Count >= Current.TimeOfAction and self.Count <= Next.TimeOfAction then
  2713. local Dis = (Next.TimeOfAction-Current.TimeOfAction)
  2714. local Perc = (self.Count-Current.TimeOfAction)/Dis
  2715. v.w.C0 = Interpolate(style or 'Linear',Current.frame.C0,Next.frame.C0)(Perc)
  2716. v.w.C1 = Interpolate(style or 'Linear',Current.frame.C1,Next.frame.C1)(Perc)
  2717.  
  2718. v.previous = v.w.C0
  2719.  
  2720. end
  2721. end end
  2722. end
  2723. end
  2724. end
  2725. Animations[name]=Anim
  2726. return Anim
  2727. end
  2728. previous_kfl=nil
  2729. function newAnim(name,lenght,loop,style,strange) --Epic wrapper for epic skids
  2730. NewLimbAnim(name)
  2731. local a=Animation.new(name,lenght,style,name)
  2732.  
  2733. if loop~=nil then
  2734. a.Loop=loop
  2735. end
  2736.  
  2737. return function(kfs)
  2738. if not kfs[0] then
  2739. local t={}
  2740. for j,v in pairs(Joints) do
  2741. t[j]=v.previous
  2742. end
  2743. kfs[0]=t
  2744. end
  2745. a.kfl=kfs
  2746.  
  2747. function a:last()
  2748. local n,o=-1,nil
  2749. for i,v in pairs(self.kfl)do
  2750. if i>n then
  2751. n=i o=v
  2752. if type(o)=='number' then
  2753. o=self.kfl[o]
  2754. end
  2755. end
  2756. end
  2757. return o
  2758. end
  2759. function a:Wait(num)
  2760. repeat wait()until self.Count>=(num or self.Span)
  2761. end
  2762. if lenght==0 then
  2763. for i,v in pairs(kfs) do
  2764. a.Span=i
  2765. end
  2766. end
  2767. for tim,kf in pairs(kfs) do
  2768. local kk=kf
  2769. if type(kf) =='number'then
  2770. kk=kfs[kf]
  2771. end
  2772.  
  2773. for j,v in pairs(kk) do
  2774. if not strange then
  2775. a:Add(tim,j, (v == 0 and Joints[j].n_c0 or (Joints[j].n_c0 * v) ))
  2776. else
  2777. a:Add(tim,j, (v == 0 and Joints[j].n_c0 or v ))
  2778. end
  2779. end
  2780. end
  2781. return a
  2782. end
  2783. end
  2784. local facetick=tick()
  2785. LerParts={}
  2786. function LerParts:Add(tag,part,value,speed)
  2787. local tt = {
  2788. p=part;c=value;s=speed;t=tag;
  2789. }
  2790. function tt:Kill()
  2791. self.p:Destroy()
  2792. LerParts[self.t]=nil
  2793. end
  2794. self[tag]=tt
  2795. end
  2796. RS:BindToRenderStep('Anim',2000,function() --Mainloop
  2797. for i,v in pairs(Animations)do --execute animations
  2798. v:Exec()
  2799. end
  2800.  
  2801. for i,v in pairs(LerParts) do --lerp parts
  2802. if type(v)~='function'then
  2803. v.p.CFrame=v.p.CFrame:lerp(v.c(),v.s)end
  2804. end
  2805.  
  2806. end)
  2807. function tablify(tab)
  2808. setmetatable(tab,{
  2809. __add = function(t,t2)
  2810. if type(t2) ~= 'table' then return end --prevent errors
  2811. local ta={}
  2812. for i,v in pairs(t) do
  2813. ta[i]=v
  2814. end
  2815. for i,v in pairs(t2) do
  2816. ta[i] = v
  2817. end
  2818. return ta
  2819. end
  2820. })
  2821. end
  2822. local init={}
  2823. tablify(init)
  2824. for i,v in pairs(Joints)do
  2825. init[i]=0
  2826. end
  2827. mighty=newAnim('c',1){
  2828. [.1]=init+{t_p=ang(md'-45');
  2829. s_r=ang(md'45',0,md'75');
  2830. s_l=ang(md'45',0,md'-75');
  2831. a_r=ang(md'25');
  2832. a_l=ang(md'25');
  2833. }
  2834. }
  2835.  
  2836. armraise=newAnim('a',.5){
  2837. [0]=init;
  2838. [.25]={
  2839. s_r=ang(md'90');
  2840. };
  2841. [.5]={
  2842. h_r=ang(md'75');
  2843. };
  2844. }
  2845. push=newAnim('a2',.25){
  2846. [0]=init+{
  2847. s_r=ang(md'90');
  2848. h_r=ang(md'75');
  2849. };
  2850. [.25]={
  2851. s_r=ang(md'90');
  2852. a_r=ang(md'45');
  2853. e_r=ang(md'15');
  2854. };
  2855. }
  2856. function laser(st,en,r)
  2857. total_mag=(st-en).magnitude
  2858. prev=cfn(st)
  2859. local mo=New"Model"{_P=Main}
  2860. set_parent=mo
  2861. local pm={-1,1}
  2862. for i=0,1,.1 do
  2863. local pos=cfn(st):lerp(cfn(en),i)
  2864. local pos2=pos*cfn(pm[mr(#pm)]*r,0,pm[mr(#pm)]*r)
  2865. local mag=(prev.p-pos2.p).magnitude
  2866. local laz=Part(.1,mag,.1,'Really red',.5)_1.Anchored=true _1.Material='Neon'
  2867. Mesh(_1,'bl',.5,1,.5)
  2868. _1.CFrame=(cfn(prev.p,pos2.p)*cfn(0,0,-mag/2))*ang(PI/2)
  2869. if i>.9 then
  2870. _1.CFrame=(cfn(prev.p,pos2.p)*cfn(0,0,-mag/2))*ang(PI/2)
  2871. end
  2872. prev=pos2
  2873. end
  2874. set_parent=nil
  2875. DEBRIS:AddItem(mo,.025)
  2876. end
  2877.  
  2878. function sparks()
  2879. local a=newAnim('sfss',2.1){
  2880. [0]=init;
  2881. [.25]={
  2882. s_r=ang(md'100',md'-25');
  2883. a_r=ang(0,0,md'-25');
  2884. h_r=ang(md'-10');
  2885.  
  2886. s_l=ang(md'80',md'25');
  2887. a_l=ang(0,0,md'25');
  2888. h_l=ang(md'-10',PI);
  2889.  
  2890. e_r=ang(md'-5');
  2891. e_l=ang(md'5');
  2892. };
  2893. [.75]={
  2894. e_r=ang(md'25');
  2895. e_l=ang(md'-25');
  2896. };
  2897. [2]=.75;
  2898. [2.1]={
  2899. e_r=ang(md'-5');
  2900. e_l=ang(md'5');
  2901. };
  2902. }a:Play()
  2903. a:Wait(.25)
  2904. changeFace('happy')
  2905. local p=Part(1,1,1,Robot.Color2)_1.Material='Neon'_1.Anchored=true
  2906. p.CFrame=heart_r.CFrame:lerp(heart_l.CFrame,.5)
  2907. 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)
  2908. -- Spawn(function()
  2909. repeat
  2910. laser(heart_r.Position,heart_l.Position,.25)
  2911. for i,v in pairs(findHum(torso.Position,30))do
  2912. if v~=human then
  2913. v.Torso.Velocity=cfn(v.Torso.Position,torso.Position).lookVector*20
  2914. v.Torso.RotVelocity=v3n(0,100,0)
  2915. end end
  2916. wait()
  2917. until a.Count>=2
  2918. changeFace('normal')
  2919. LerParts['orb']:Kill()
  2920. local ring=Part(1,1,1,'Really red',.5)_1.Anchored=true
  2921. local msh=Mesh(_1,mesh_ids.ring)
  2922. ring.CFrame=cfn(heart_r.CFrame:lerp(heart_l.CFrame,.5).p)*ang(PI/2,0,0)
  2923. for i=0,1,.1 do
  2924. msh.Scale=v3n(i*20,i*20,1)
  2925. ring.Transparency=.5+i*.5
  2926. wait()
  2927. end
  2928. ring:Destroy()
  2929. a:Wait()a:Stop()
  2930. reset()
  2931. -- end)
  2932.  
  2933. end
  2934. -- o=newAnim("werwer",.5){
  2935. -- [0]=init;
  2936. -- [.1]={
  2937. -- t_p=ang(md'15',md'25');
  2938. -- s_l=ang(md'45');
  2939. -- s_r=ang(md'45');
  2940. -- };
  2941. -- [.5]={
  2942. -- t_p=ang(md'-15',md'-25');
  2943. -- s_l=ang(md'140',0,md'75');
  2944. -- s_r=ang(md'140',0,md'75');
  2945. -- h_r=ang(0,PI/2);
  2946. -- a_l=0;
  2947. -- };
  2948. -- }o:Play()o:Wait()
  2949. -- o.Playing=false
  2950. -- o:Stop()
  2951. -- o2=newAnim('ww',.5,true){
  2952. -- [0]=o:last();
  2953. -- [.2]={
  2954. -- t_p=ang(md'15',md'25');
  2955. -- s_l=ang(md'45',0,md'75');
  2956. -- s_r=ang(md'45',0,md'75');
  2957. -- a_l=ang(md'-15',md'15')
  2958. -- };
  2959. -- [.5]=0
  2960. -- }o2:Play()
  2961.  
  2962. function reset()
  2963. local cc=newAnim('sfs',.5,false,_,true){
  2964. [.5]=init;
  2965. }cc:Play()cc:Wait()cc:Stop()
  2966. end
  2967. human.Died:connect(function() --onDeath
  2968. e=Instance.new("Explosion",Workspace)
  2969. e.Position=torso.Position
  2970. e.BlastRadius=30
  2971. end)
  2972. function beam()
  2973. armraise.Count=0
  2974. armraise:Play()
  2975. armraise:Wait()
  2976.  
  2977. for i=1,30 do
  2978. local bl=Part(.1,.1,.1,'Really red',.5)
  2979. _1.Material='Neon'
  2980. _1.CFrame=l(heart_r,mr(-3,3),mr(-3,3))
  2981. Mesh(_1,'s')
  2982. New"BodyPosition"{_P=bl;position=heart_r.Position}
  2983. DEBRIS:AddItem(bl,.3)
  2984. wait()
  2985. end
  2986.  
  2987. local obj,pos=Workspace:FindPartOnRay(Ray.new(l(heart_r).p,l(heart_r).lookVector*100),character)
  2988. if obj and pos then
  2989. changeFace("xD")
  2990. local mag = (l(heart_r).p-pos).magnitude
  2991. local laz=Part(1,mag,1,'Really red')_1.Anchored=true
  2992. local msh=Mesh(laz,'cyl')
  2993. local lista={}
  2994. laz.CFrame=(cfn(l(heart_r).p,pos)*cfn(0,0,-mag/2))*ang(PI/2)
  2995.  
  2996. for i,v in pairs(findHum(pos,10))do
  2997. if v~=human then
  2998. v.Health=0 end
  2999. end
  3000.  
  3001. for i=0,1,1/4 do
  3002. local r=Part(1,1,1,'Really red',.5)_1.Anchored=true
  3003. r.CFrame=l(laz,0,-laz.Size.y/2+laz.Size.y*i,0,PI/2)
  3004. local msh=Mesh(r,mesh_ids.ring)
  3005. table.insert(lista,r)
  3006. end
  3007.  
  3008. local ss=mesh_scales.ring*v3n(laz.Size.x,laz.Size.z,1)
  3009. Spawn(function()
  3010. for i=0,1,.05 do
  3011. Edit{msh,laz}{Transparency=i;Scale=v3n(1+i*3,1,1+i*3)}
  3012. Edit(lista){Transparency=i;['Mesh.Scale']=ss+v3n(i*10,i*10,1)}
  3013. wait()
  3014. end
  3015. laz:Destroy()
  3016. for i,v in pairs(lista)do v:Destroy()end
  3017. end)
  3018. end
  3019. push:Play()
  3020. push:Wait()
  3021. push:Stop()
  3022. armraise:Stop()
  3023. changeFace('normal')
  3024. reset()
  3025. end
  3026. Mouse=player:GetMouse()
  3027. atacking=false
  3028. mouse_con1=Mouse.KeyDown:connect(function(key)
  3029. attacking=true
  3030.  
  3031. if key=='f'then
  3032. beam()
  3033. elseif key=='r'then
  3034. sparks()
  3035. end
  3036.  
  3037. attacking=false
  3038. end)
  3039. --Maeking sure it wont go insane--
  3040. New"BindableFunction"{_P=script;Name='sidos'}.OnInvoke=function()
  3041. mouse_con1:disconnect()
  3042. end
  3043. script.Name='riimu'
  3044.  
  3045. z = Instance.new("Sound", hole)
  3046. z.SoundId = "rbxassetid://162701939" -- Put Music ID Here.
  3047. z.Looped = true
  3048. z.Volume = 2
  3049. wait(.1)
  3050. z:Play()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement