Daniel_Jackson

Book roblox script (Local script)

Jul 1st, 2016
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.70 KB | None | 0 0
  1. local plr = game.Players.LocalPlayer
  2. local name = "Book"
  3. if plr.Backpack:FindFirstChild(name) then plr.Backpack[Ancor]:Destroy() end
  4. local t = Instance.new("HopperBin",plr.Backpack)
  5. t.Name = name
  6. script.Parent = nil
  7. local char = plr.Character
  8. local mouse = nil
  9. local RA,LA = char["Right Arm"],char["Left Arm"]
  10. local rs,ls = char.Torso["Right Shoulder"],char.Torso["Left Shoulder"]
  11. local RS,LS = rs:Clone(),ls:Clone()
  12. RS.Part0 = nil
  13. RS.Part1 = nil
  14. LS.Part0 = nil
  15. LS.Part1 = nil
  16. RS.Parent = char.Torso
  17. LS.Parent = char.Torso
  18. RS.DesiredAngle = 0
  19. LS.DesiredAngle = 0
  20. local eDb = false
  21. local sDb = false
  22. local cS = 1
  23. function Weld2(p1,p2)
  24. local w = Instance.new("Weld")
  25. w.Part0 = p1
  26. w.Part1 = p2
  27. w.C0 = p1.CFrame:toObjectSpace(p2.CFrame)
  28. w.Parent = p1
  29. return w
  30. end
  31. function Weld(p1,p2)
  32. local w = Instance.new("Weld")
  33. w.Part0 = p1
  34. w.Part1 = p2
  35. w.Parent = p1
  36. return w
  37. end
  38. function createBook()
  39. if char:FindFirstChild("Book") then char.Book:Destroy() end
  40. if LA:FindFirstChild("grip") then La.grip:Destroy() end
  41. local width = .3 -- .3
  42. local height = 1.5 -- 1.5
  43. local length = 1 -- 1
  44. book = Instance.new("Model",char)
  45. book.Name = "Book"
  46. local base = Instance.new("Part",book)
  47. Instance.new("BlockMesh",base)
  48. base.FormFactor = "Custom"
  49. base.BrickColor = BrickColor.new("Dark orange")
  50. base.Size = Vector3.new(width,.2,height)
  51. base.Mesh.Scale = Vector3.new(1,.5,1)
  52. base:BreakJoints()
  53. base.TopSurface = "Smooth"
  54. base.BottomSurface = "Smooth"
  55. local grip = Weld(LA,base)
  56. grip.Name = "grip"
  57. grip.C0 = CFrame.new(.3,-.9,0)
  58. local sid1 = base:Clone()
  59. sid1.Mesh.Scale = Vector3.new(.2,1,1)
  60. sid1.Parent = book
  61. sid1.Size = Vector3.new(.2,length,height)
  62. local sid2 = sid1:Clone()
  63. sid2.Parent = book
  64. local m = Instance.new("Motor6D")
  65. m.Parent = book
  66. m.Name = "open1"
  67. m.C0 = CFrame.new(-(width/2)+.02,0,0) * CFrame.Angles(0,0,0)
  68. m.C1 = CFrame.new(0,length/2,0)
  69. m.MaxVelocity = .2
  70. m.Part0 = base
  71. m.Part1 = sid1
  72. m.DesiredAngle = 0
  73. local m2 = m:Clone()
  74. m2.Name = "open2"
  75. m2.C0 = CFrame.new((width/2)-.02,0,0) * CFrame.Angles(0,math.pi,0)
  76. m2.C1 = CFrame.new(0,length/2,0)
  77. m2.Part0 = base
  78. m2.Part1 = sid2
  79. m2.Parent = book
  80. local p1 = sid1:Clone()
  81. p1.Parent = book
  82. p1.BrickColor = BrickColor.new("White")
  83. p1.Size = Vector3.new(width/2,length-.1,height-.4)
  84. p1.Mesh.Scale = Vector3.new(1,1,1)
  85. local p2 = p1:Clone()
  86. p2.Parent = book
  87. local w1 = Weld(sid1,p1)
  88. w1.C0 = CFrame.new(width/4+0.01,.05,0)
  89. local w2 = Weld(sid2,p2)
  90. w2.C0 = CFrame.new(width/4+0.01,.05,0)
  91. local p3 = p2:Clone()
  92. p3.Parent = book
  93. p3.Size = Vector3.new(width-.05,width/2,height-.4)
  94. local w3 = Weld(base,p3)
  95. w3.C0 = CFrame.new(0,-width/4,0)
  96. local cp1 = p1:Clone()
  97. cp1.Parent = book
  98. cp1.Mesh.Scale = Vector3.new(.25,1,1)
  99. cp1.Transparency = 1
  100. cp1.Name = "page"
  101. local cpmot1 = m:Clone()
  102. cpmot1.Part0 = base
  103. cpmot1.Part1 = cp1
  104. cpmot1.Name = "pageflip"
  105. cpmot1.C0 = CFrame.new(0,0,0)
  106. cpmot1.Parent = book
  107. base.Name = "base"
  108. end
  109. function getAniFrame(w1,w2,am,cur)
  110. local c0 = {w1.X,w1.Y,w1.Z,w1:toEulerAnglesXYZ()}
  111. local c1 = {w2.X,w2.Y,w2.Z,w2:toEulerAnglesXYZ()}
  112. local cf = {}
  113. for i,v in pairs(c0) do
  114. cf[i] = c1[i]-v
  115. end
  116. return CFrame.new(c0[1]+(cur/am)*cf[1], c0[2]+(cur/am)*cf[2], c0[3]+(cur/am)*cf[3])*CFrame.Angles(c0[4]+(cur/am)*cf[4],c0[5]+(cur/am)*cf[5],c0[6]+(cur/am)*cf[6])
  117. end
  118. function Init()
  119. createBook()
  120. end
  121. function dealDamage(hum,dmg)
  122. print("Damaged "..hum.Parent.Name.." for "..dmg)
  123. local hp = hum.Health
  124. if hp == 0 then return end
  125. hum:TakeDamage(dmg)
  126. if dmg > 0 and (hum.Health >= hp or hum.MaxHealth == 0 or hum.MaxHealth == math.huge) then dmg = "Resisted! ("..dmg..")" end
  127. if game.Players:GetPlayerFromCharacter(hum.Parent) == nil then return end
  128. local m = Instance.new("Model",workspace)
  129. m.Name = dmg < 0 and "+"..math.abs(dmg) or dmg
  130. local h = Instance.new("Humanoid",m)
  131. h.Name = "SHOWDATCOOKIE!"
  132. h.MaxHealth = 0
  133. local p = Instance.new("Part",m)
  134. p.Name = "Head"
  135. p.FormFactor = "Custom"
  136. p.Size = Vector3.new(.2,.2,.2)
  137. p.Transparency = 0.97
  138. p.CanCollide = false
  139. p.Anchored = true
  140. p:BreakJoints()
  141. game.Debris:AddItem(p,5)
  142. pcall(function() p.CFrame = CFrame.new(hum.Parent.Torso.Position) * CFrame.new(math.random(-2,2),math.random(-1,1),math.random(-2,2)) end)
  143. local rAm = math.random(3,6)/100
  144. coroutine.resume(coroutine.create(function()
  145. for i=1,300 do
  146. p.CFrame = p.CFrame * CFrame.new(0,rAm,0)
  147. wait(1/60)
  148. end
  149. p:Destroy()
  150. end))
  151. end
  152. function changeSpell(spell)
  153. if cS == spell or sDb or eDb or spell == 0 then return end
  154. local nextPage = true
  155. if cS > spell then nextPage = false end
  156. cS = spell
  157. sDb = true
  158. eDb = true
  159. rs.Part0 = nil
  160. rs.Part1 = nil
  161. RS.CurrentAngle = rs.CurrentAngle
  162. RS.Part0 = char.Torso
  163. RS.Part1 = RA
  164. if nextPage then
  165. RS.DesiredAngle = math.rad(90)
  166. for i=1,15 do
  167. RS.C1 = RS.C1 * CFrame.Angles(math.rad(-2),0,0)
  168. LS.C1 = LS.C1 * CFrame.Angles(math.rad(-0.5),0,0)
  169. wait(1/60)
  170. end
  171. repeat wait() until math.abs(RS.DesiredAngle-RS.CurrentAngle) < .01
  172. for i=1,3 do
  173. RS.C1 = RS.C1 * CFrame.new(0,0.1,0)
  174. LS.C1 = LS.C1 * CFrame.Angles(math.rad(-2.5),0,0)
  175. wait(1/60)
  176. end
  177. book.pageflip.MaxVelocity = .3
  178. book.pageflip.CurrentAngle = -1.3
  179. book.pageflip.DesiredAngle = 1.3
  180. book.page.Transparency = 0
  181. for i=1,3 do
  182. RS.C1 = RS.C1 * CFrame.new(0,-0.1,0) * CFrame.Angles(math.rad(-3),0,0)
  183. wait(1/60)
  184. end
  185. for i=1,3 do
  186. LS.C1 = LS.C1 * CFrame.Angles(math.rad(5),0,0)
  187. RS.C1 = RS.C1 * CFrame.Angles(math.rad(3),0,0)
  188. wait(1/60)
  189. end
  190. RS.DesiredAngle = math.rad(0)
  191. for i=1,10 do
  192. RS.C1 = RS.C1 * CFrame.Angles(math.rad(3),0,0)
  193. wait(1/60)
  194. end
  195. repeat wait() until math.abs(RS.DesiredAngle-RS.CurrentAngle) < .01
  196. else -------------------------------------RAAAAAAAAAAAAAAAAAAaaa
  197. for i=1,3 do
  198. LS.C1 = LS.C1 * CFrame.Angles(math.rad(2),0,0)
  199. wait(1/60)
  200. end
  201. book.pageflip.MaxVelocity = .25
  202. book.pageflip.CurrentAngle = 1.3
  203. book.pageflip.DesiredAngle = -1.3
  204. book.page.Transparency = 0
  205. for i=1,3 do
  206. LS.C1 = LS.C1 * CFrame.Angles(math.rad(-2),0,0)
  207. wait(1/60)
  208. end
  209. repeat wait() until math.abs(book.pageflip.DesiredAngle-book.pageflip.CurrentAngle) < .01
  210. end
  211. book.page.Transparency = 1
  212. book.pageflip.MaxVelocity = .2
  213. RS.Part0 = nil
  214. RS.Part1 = nil
  215. rs.CurrentAngle = 0
  216. rs.Part0 = char.Torso
  217. rs.Part1 = RA
  218. RS.C0 = rs.C0
  219. RS.C1 = rs.C1
  220. RS.MaxVelocity = rs.MaxVelocity
  221. RS.DesiredAngle = 0
  222. RS.CurrentAngle = 0
  223. sDb = false
  224. eDb = false
  225. end
  226. function makeRPlate(color)
  227. local p = Instance.new("Part",book)
  228. Instance.new("BlockMesh",p)
  229. p.FormFactor = "Custom"
  230. p.Size = Vector3.new(1,.2,1)
  231. p.Transparency = 0.4
  232. p.CanCollide = false
  233. p.BrickColor = BrickColor.new(color)
  234. p:BreakJoints()
  235. p.CFrame = RA.CFrame * CFrame.new(0,-1,0)
  236. Weld2(char.Torso,p).Parent = p
  237. return p
  238. end
  239. function M1Down()
  240. if eDb or sDb then return end
  241. sDb = true
  242. local spot = mouse.Hit.p
  243. rs.Part0 = nil
  244. rs.Part1 = nil
  245. RS.CurrentAngle = rs.CurrentAngle
  246. RS.Part0 = char.Torso
  247. RS.Part1 = RA
  248. if cS == 1 then
  249. char.Torso.Neck.DesiredAngle = .3
  250. wait(.3)
  251. RS.DesiredAngle = math.rad(90)
  252. repeat wait() until math.abs(RS.DesiredAngle-RS.CurrentAngle) < .01
  253. wait(.05)
  254. RS.C1 = RS.C1 * CFrame.new(0,.1,0)
  255. local p1 = makeRPlate("White")
  256. char.Torso.Neck.DesiredAngle = 0
  257. wait(.05)
  258. RS.C1 = RS.C1 * CFrame.new(0,-.1,0)
  259. char.Torso.Neck.DesiredAngle = 0.3
  260. RS.DesiredAngle = math.rad(140)
  261. repeat wait() until math.abs(RS.DesiredAngle-RS.CurrentAngle) < .01
  262. RS.C1 = RS.C1 * CFrame.new(0,.1,0)
  263. local p2 = makeRPlate("White")
  264. char.Torso.Neck.DesiredAngle = 0
  265. wait(.05)
  266. RS.C1 = RS.C1 * CFrame.new(0,-.1,0)
  267. RS.DesiredAngle = math.rad(90)
  268. repeat wait() until math.abs(RS.DesiredAngle-RS.CurrentAngle) < .01
  269. for i=1,10 do
  270. RS.C1 = RS.C1 * CFrame.Angles(math.rad(5),0,0)
  271. wait(1/60)
  272. end
  273. RS.C1 = RS.C1 * CFrame.new(0,.1,0)
  274. local p3 = makeRPlate("White")
  275. wait(.05)
  276. RS.C1 = RS.C1 * CFrame.new(0,-.1,0)
  277. for i=1,10 do
  278. RS.C1 = RS.C1 * CFrame.Angles(math.rad(-10),0,0)
  279. wait(1/60)
  280. end
  281. RS.C1 = RS.C1 * CFrame.new(0,.1,0)
  282. local p4 = makeRPlate("White")
  283. wait(.05)
  284. RS.C1 = RS.C1 * CFrame.new(0,-.1,0)
  285. for i=1,10 do
  286. RS.C1 = RS.C1 * CFrame.Angles(math.rad(5),0,0)
  287. wait(1/60)
  288. end
  289. RS.DesiredAngle = math.rad(40)
  290. repeat wait() until math.abs(RS.DesiredAngle-RS.CurrentAngle) < .01
  291. RS.C1 = RS.C1 * CFrame.new(0,.1,0)
  292. local p5 = makeRPlate("White")
  293. wait(.05)
  294. RS.C1 = RS.C1 * CFrame.new(0,-.1,0)
  295. char.Torso.Neck.DesiredAngle = 0
  296. RS.DesiredAngle = math.rad(90)
  297. repeat wait() until math.abs(RS.DesiredAngle-RS.CurrentAngle) < .01
  298. for i=1,30 do
  299. RS.C1 = RS.C1 * CFrame.new(0,-.02,0)
  300. p2.Weld.C0 = getAniFrame(p2.Weld.C0,p1.Weld.C0,55,i)
  301. p3.Weld.C0 = getAniFrame(p3.Weld.C0,p1.Weld.C0,55,i)
  302. p4.Weld.C0 = getAniFrame(p4.Weld.C0,p1.Weld.C0,55,i)
  303. p5.Weld.C0 = getAniFrame(p5.Weld.C0,p1.Weld.C0,55,i)
  304. wait(1/60)
  305. end
  306. wait(.05)
  307. for i=1,3 do
  308. RS.C1 = RS.C1 * CFrame.new(0,.2,0)
  309. wait(1/60)
  310. end
  311. p2:Destroy()
  312. p3:Destroy()
  313. p4:Destroy()
  314. p5:Destroy()
  315. p1.Transparency = 1
  316. local s = Instance.new("Sound",p1)
  317. s.Pitch = 2
  318. s.SoundId = "http://www.roblox.com/asset/?id=12222005"
  319. s:Play()
  320. game.Debris:AddItem(p1,1)
  321. local Hammer = Instance.new("Part")
  322. Hammer.CanCollide = false
  323. Hammer.Parent = workspace
  324. Hammer.FormFactor = "Symmetric"
  325. Hammer.Size = Vector3.new(1,4,2)
  326. Hammer.BrickColor = BrickColor.new("Light blue")
  327. Hammer.Reflectance = 0.4
  328. Hammer.Transparency = 0.5
  329. local FM = Instance.new("SpecialMesh",Hammer)
  330. FM.MeshType = "FileMesh"
  331. FM.MeshId = "http://www.roblox.com/asset/?id=1279013"
  332. FM.Scale = FM.Scale * 1.05
  333. local lh = 0
  334. Hammer.Touched:connect(function(hit) if tick()-lh < 0.05 then return end lh = tick() local hum = hit.Parent:FindFirstChild("Humanoid") if not hum then hum = hit.Parent.Parent:FindFirstChild("Humanoid") end if not hum then return end dealDamage(hum,math.random(35,40)) end)
  335. Hammer.CFrame = CFrame.new((p1.CFrame * CFrame.new(0,-4,0)).p,spot)
  336. Instance.new("BodyForce",Hammer).force = Vector3.new(0,Hammer:GetMass()*180,0)
  337. Hammer:BreakJoints()
  338. --Hammer.Velocity = (spot-Hammer.Position).unit*300
  339. Hammer.Velocity = char.Torso.CFrame.lookVector*300
  340. Hammer.RotVelocity = Vector3.new(900,0,0)
  341. game.Debris:AddItem(Hammer,5)
  342. RS.MaxVelocity = 0.15
  343. RS.DesiredAngle = 0
  344. repeat wait() until math.abs(RS.DesiredAngle-RS.CurrentAngle) < .01
  345. end
  346. if cS == 2 then
  347. local Plates = {}
  348. char.Torso.Neck.DesiredAngle = 0.3
  349. wait(.2)
  350. for i=1,30 do
  351. RS.C1 = RS.C1 * CFrame.Angles(0,0,math.rad(-140/30))
  352. wait(1/60)
  353. end
  354. RS.C1 = RS.C1 * CFrame.new(-.1,0,0)
  355. table.insert(Plates,makeRPlate("Bright green"))
  356. wait(.05)
  357. RS.C1 = RS.C1 * CFrame.new(.1,0,0)
  358. char.Torso.Neck.DesiredAngle = 0
  359. wait(.3)
  360. char.Torso.Neck.DesiredAngle = 0.3
  361. wait(.3)
  362. char.Torso.Neck.DesiredAngle = 0
  363. wait(.5)
  364. for i=1,5 do
  365. RS.C1 = RS.C1 * CFrame.Angles(0,0,math.rad(50/5))
  366. wait(1/60)
  367. end
  368. RS.C1 = RS.C1 * CFrame.new(-.1,0,0)
  369. local p = makeRPlate("Bright green")
  370. wait(.05)
  371. RS.C1 = RS.C1 * CFrame.new(.1,0,0)
  372. for i=1,5 do
  373. RS.C1 = RS.C1 * CFrame.Angles(0,0,math.rad(50/5))
  374. wait(1/60)
  375. end
  376. RS.C1 = RS.C1 * CFrame.new(-.1,0,0)
  377. table.insert(Plates,makeRPlate("Bright green"))
  378. wait(.05)
  379. RS.C1 = RS.C1 * CFrame.new(.1,0,0)
  380. for i=1,10 do
  381. RS.C1 = RS.C1 * CFrame.Angles(math.rad(6),0,0)
  382. wait(1/60)
  383. end
  384. RS.C1 = RS.C1 * CFrame.new(-.1,0,0)
  385. table.insert(Plates,makeRPlate("Bright green"))
  386. wait(.05)
  387. RS.C1 = RS.C1 * CFrame.new(.1,0,0)
  388. for i=1,10 do
  389. RS.C1 = RS.C1 * CFrame.Angles(math.rad(-6),0,0)
  390. wait(1/60)
  391. end
  392. for i=1,10 do
  393. RS.C1 = RS.C1 * CFrame.Angles(0,0,math.rad(-40/10))
  394. wait(1/60)
  395. end
  396. wait(.5)
  397. for i=1,30 do
  398. RS.C1 = RS.C1 * CFrame.new(.02,0,0)
  399. for i,v in pairs(Plates) do
  400. v.Weld.C0 = getAniFrame(v.Weld.C0,p.Weld.C0,40,i)
  401. end
  402. wait(1/60)
  403. end
  404. wait(.05)
  405. for i=1,3 do
  406. RS.C1 = RS.C1 * CFrame.new(-.2,0,0)
  407. wait(1/60)
  408. end
  409. for i,v in pairs(Plates) do
  410. v:Destroy()
  411. end
  412. p.Transparency = 1
  413. local s = Instance.new("Sound",p)
  414. s.Pitch = 2
  415. s.SoundId = "http://www.roblox.com/asset/?id=12222005"
  416. s:Play()
  417. for i,v in pairs(game.Players:GetPlayers()) do
  418. if v:DistanceFromCharacter(p.Position) < 15 then
  419. pcall(function()
  420. dealDamage(v.Character.Humanoid,-80)
  421. end)
  422. coroutine.resume(coroutine.create(function()
  423. local tar = v.Character.Torso
  424. local p1 = Instance.new("Part",workspace)
  425. p1.BrickColor = BrickColor.new("White")
  426. p1.FormFactor = "Custom"
  427. p1.Reflectance = .1
  428. p1.CanCollide = false
  429. Instance.new("BlockMesh",p1)
  430. p1.Size = Vector3.new(1,1,1)
  431. p1:BreakJoints()
  432. p1.Transparency = .5
  433. local p2 = p1:Clone()
  434. p2.Parent = workspace
  435. p2:BreakJoints()
  436. p2.BrickColor = BrickColor.new("Dark green")
  437. p2.Transparency = .6
  438. local w1 = Weld(tar,p1)
  439. local w2 = Weld(tar,p2)
  440. for i=1,45 do
  441. w1.C1 = w1.C1 * CFrame.Angles(math.random()-.5,math.random()-.5,math.random()-.5)
  442. w2.C1 = w2.C1 * CFrame.Angles(math.random()-.5,math.random()-.5,math.random()-.5)
  443. p1.Mesh.Scale = p1.Mesh.Scale * 1.02
  444. p2.Mesh.Scale = p2.Mesh.Scale * 1.02
  445. wait()
  446. end
  447. for i=1,30 do
  448. w1.C1 = w1.C1 * CFrame.Angles(math.random()-.5,math.random()-.5,math.random()-.5)
  449. w2.C1 = w2.C1 * CFrame.Angles(math.random()-.5,math.random()-.5,math.random()-.5)
  450. p1.Transparency = .5+.5/30*i
  451. p2.Transparency = .6+.4/30*i
  452. wait()
  453. end
  454. p1:Destroy()
  455. p2:Destroy()
  456. end))
  457. end end
  458. wait(1)
  459. end
  460. if cS == 3 then
  461. local Plates = {}
  462. char.Torso.Neck.DesiredAngle = 0.3
  463. wait(1)
  464. char.Torso.Neck.DesiredAngle = 0
  465. wait(.2)
  466. local temp = RS.C1
  467. for i=1,15 do
  468. RS.C1 = getAniFrame(temp,temp*CFrame.Angles(0,0,math.rad(-90)),15,i)
  469. wait(1/60)
  470. end
  471. RS.C1 = RS.C1 * CFrame.new(-.1,0,0)
  472. local p = makeRPlate("Reddish brown")
  473. wait(.05)
  474. RS.C1 = RS.C1 * CFrame.new(.1,0,0)
  475. local temp2 = RS.C1
  476. for i=1,10 do
  477. RS.C1 = getAniFrame(temp2,temp*CFrame.Angles(math.rad(50),0,math.rad(-40)),10,i)
  478. wait(1/60)
  479. end
  480. RS.C1 = RS.C1 * CFrame.new(-.1,0,0)
  481. table.insert(Plates,makeRPlate("Reddish brown"))
  482. wait(.05)
  483. RS.C1 = RS.C1 * CFrame.new(.1,0,0)
  484. temp2 = RS.C1
  485. local temp2 = RS.C1
  486. for i=1,10 do
  487. RS.C1 = getAniFrame(temp2,temp*CFrame.Angles(math.rad(-50),0,math.rad(-40)),10,i)
  488. wait(1/60)
  489. end
  490. RS.C1 = RS.C1 * CFrame.new(-.1,0,0)
  491. table.insert(Plates,makeRPlate("Reddish brown"))
  492. wait(.05)
  493. RS.C1 = RS.C1 * CFrame.new(.1,0,0)
  494. local temp2 = RS.C1
  495. for i=1,10 do
  496. RS.C1 = getAniFrame(temp2,temp*CFrame.Angles(math.rad(0),0,math.rad(-140)),10,i)
  497. wait(1/60)
  498. end
  499. RS.C1 = RS.C1 * CFrame.new(-.1,0,0)
  500. table.insert(Plates,makeRPlate("Reddish brown"))
  501. wait(.05)
  502. RS.C1 = RS.C1 * CFrame.new(.1,0,0)
  503. local temp2 = RS.C1
  504. for i=1,10 do
  505. RS.C1 = getAniFrame(temp2,temp*CFrame.Angles(math.rad(0),0,math.rad(-90)),10,i)
  506. wait(1/60)
  507. end
  508. wait(.05)
  509. for i=1,30 do
  510. RS.C1 = RS.C1 * CFrame.new(.02,0,0)
  511. for i,v in pairs(Plates) do
  512. v.Weld.C0 = getAniFrame(v.Weld.C0,p.Weld.C0,31,i)
  513. end
  514. wait(1/60)
  515. end
  516. wait(.05)
  517. for i=1,3 do
  518. RS.C1 = RS.C1 * CFrame.new(-.2,0,0)
  519. wait(1/60)
  520. end
  521. for i,v in pairs(Plates) do
  522. v:Destroy()
  523. end
  524. p.Transparency = 1
  525. local s = Instance.new("Sound",p)
  526. s.Pitch = 2
  527. s.SoundId = "http://www.roblox.com/asset/?id=12222005"
  528. s:Play()
  529. local nlist = ""
  530. for i=1,10 do
  531. local pa = Instance.new("Part",workspace)
  532. pa.Anchored = true
  533. Instance.new("BlockMesh",pa)
  534. pa.BrickColor = BrickColor.new("Reddish brown")
  535. pa.Size = Vector3.new(5,8,5)
  536. pa:BreakJoints()
  537. pa.CFrame = CFrame.new(char.Torso.Position) * CFrame.Angles(math.random()-.5,math.random()-.5,math.random()-.5) + Vector3.new(0,-8,0) + char.Torso.CFrame.lookVector*(i+1)*3.5
  538. local on = true
  539. local con = pa.Touched:connect(function(hit)
  540. pcall(function()
  541. local hum = hit.Parent:FindFirstChild("Humanoid")
  542. if not hum then hum = hit.Parent.Parent:FindFirstChild("Humanoid") end
  543. if not hum or game.Players:GetPlayerFromCharacter(hum.Parent) == nil or nlist:lower():find("|"..hum.Parent.Name:lower().."|") or hum.Parent == char then return end
  544. hum.Sit = true
  545. hum.Parent.Torso.Velocity = hum.Parent.Torso.Velocity + Vector3.new(math.random()-.5,8,math.random()-.5)
  546. nlist = nlist.."|"..hum.Parent.Name.."|"
  547. dealDamage(hum,math.random(32,38))
  548. end)
  549. end)
  550. coroutine.resume(coroutine.create(function()
  551. wait(i*0.1)
  552. for i=1,math.random(4,6) do
  553. pa.CFrame = pa.CFrame + Vector3.new(0,1,0)
  554. wait(1/60)
  555. end
  556. wait(.5)
  557. con:disconnect()
  558. for i=0,1,.05 do
  559. pa.Transparency = i
  560. wait(1/60)
  561. end
  562. pa:Destroy()
  563. end))
  564. end
  565. end
  566. RS.Part0 = nil
  567. RS.Part1 = nil
  568. rs.CurrentAngle = 0
  569. rs.Part0 = char.Torso
  570. rs.Part1 = RA
  571. RS.C0 = rs.C0
  572. RS.C1 = rs.C1
  573. RS.MaxVelocity = rs.MaxVelocity
  574. RS.DesiredAngle = 0
  575. RS.CurrentAngle = 0
  576. sDb = false
  577. end
  578. function KDown(key)
  579. if key == "q" then
  580. changeSpell(cS-1)
  581. elseif key == "e" then
  582. changeSpell(cS+1)
  583. end
  584. end
  585. function Select(m)
  586. mouse = m
  587. if eDb == true then repeat wait() until eDb == false if not t.Active then return end end
  588. mouse.Button1Down:connect(M1Down)
  589. mouse.KeyDown:connect(KDown)
  590. eDb = true
  591. ls.Part0 = nil
  592. ls.Part1 = nil
  593. LS.CurrentAngle = ls.CurrentAngle
  594. LS.Part0 = char.Torso
  595. LS.Part1 = LA
  596. LS.MaxVelocity = .2
  597. LS.DesiredAngle = math.rad(-90)
  598. repeat wait() until math.abs(LS.DesiredAngle-LS.CurrentAngle) < .05
  599. for i=1,20 do
  600. LS.C1 = LS.C1 * CFrame.Angles(math.rad(-1),math.rad(-1),0)
  601. wait(1/60)
  602. end
  603. book.open1.DesiredAngle = -1.3
  604. book.open2.DesiredAngle = -1.3
  605. char.Torso.Neck.DesiredAngle = .3
  606. for i=1,10 do
  607. LA.grip.C1 = LA.grip.C1 * CFrame.new(.01,0.02,0) * CFrame.Angles(0,0,math.rad(-10))
  608. wait(1/60)
  609. end
  610. eDb = false
  611. wait(.2)
  612. char.Torso.Neck.DesiredAngle = 0
  613. end
  614. function Deselect()
  615. repeat wait() until not eDb and not sDb
  616. eDb = true
  617. book.open1.DesiredAngle = 0
  618. book.open2.DesiredAngle = 0
  619. for i=1,10 do
  620. LA.grip.C1 = LA.grip.C1 * CFrame.new(-.01,-0.02,0) * CFrame.Angles(0,0,math.rad(10))
  621. wait(1/60)
  622. end
  623. for i=1,20 do
  624. LS.C1 = LS.C1 * CFrame.Angles(math.rad(1),math.rad(1),0)
  625. wait(1/60)
  626. end
  627. LS.DesiredAngle = 0
  628. repeat wait() until math.abs(LS.DesiredAngle-LS.CurrentAngle) < .05
  629. LS.Part0 = nil
  630. LS.Part1 = nil
  631. ls.CurrentAngle = 0
  632. ls.Part0 = char.Torso
  633. ls.Part1 = LA
  634. LS.C0 = ls.C0
  635. LS.C1 = ls.C1
  636. LS.MaxVelocity = ls.MaxVelocity
  637. LS.DesiredAngle = 0
  638. LS.CurrentAngle = 0
  639. createBook()
  640. eDb = false
  641. end
  642. Init()
  643. t.Selected:connect(Select)
  644. t.Deselected:connect(Deselect)
  645. Game.Workspace.kash5.Animate:remove()
Add Comment
Please, Sign In to add comment