deishuu

Untitled

Mar 4th, 2018
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.87 KB | None | 0 0
  1. --[[
  2. Script Version 1
  3.  
  4. Magic booklet.
  5. Script by Ronnie124 (revised by DarkShadow6)
  6. --]]
  7.  
  8.  
  9. if script == nil then return end
  10.  
  11.  
  12. Player = game:GetService("Players").LocalPlayer
  13. Char = Player.Character
  14. animate = Char:findFirstChild("Animate")
  15. if animate then
  16. animate:remove()
  17. end
  18. Name = "Magic Booklet"
  19. selected = false
  20. Button1Down = false
  21. canFire = true
  22. spell = 0
  23.  
  24.  
  25. function makeParts()
  26. local model = Instance.new("Model")
  27. model.Name = Name
  28. model.Parent = Player.Character
  29. local pm = Instance.new("Part")
  30. pm.Name = "Handle"
  31. pm.FormFactor = "Plate"
  32. pm.Size = Vector3.new(1, 0.15, 0.5)
  33. pm.BrickColor = BrickColor.new("Really black")
  34. pm.Locked = true
  35. pm.TopSurface = 0
  36. pm.BottomSurface = 0
  37. pm.Parent = model
  38. local m = Instance.new("SpecialMesh")
  39. m.MeshType = "FileMesh"
  40. m.Scale = Vector3.new(0.7, 0.5, 0.5)
  41. m.MeshId = "http://www.roblox.com/Asset/?id=1136139"
  42. m.TextureId = "fb0b0800411509923ef4d41a46888323"
  43. m.Parent = pm
  44. local w = Instance.new("Weld")
  45. w.Part0 = pm
  46. w.Part1 = Player.Character:FindFirstChild("Right Arm")
  47. w.C0 = CFrame.new(0, 1.1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  48. w.C1 = CFrame.new()
  49. w.Parent = pm
  50. end
  51.  
  52.  
  53. function removeParts()
  54. if Player.Character:FindFirstChild(Name) ~= nil then
  55. Player.Character[Name]:Remove()
  56. end
  57. end
  58.  
  59.  
  60. function SetAngle(Joint, Angle, Character)
  61. if Character == nil then return false end
  62. local Joints = {
  63. Character.Torso:FindFirstChild("Right Shoulder 2"),
  64. Character.Torso:FindFirstChild("Left Shoulder 2"),
  65. Character.Torso:FindFirstChild("Right Hip 2"),
  66. Character.Torso:FindFirstChild("Left Hip 2")
  67. }
  68. if Joints[Joint] == nil then return false end
  69. if Joint == 1 or Joint == 3 then
  70. Joints[Joint].DesiredAngle = Angle
  71. end
  72. if Joint == 2 or Joint == 4 then
  73. Joints[Joint].DesiredAngle = -Angle
  74. end
  75. end
  76.  
  77.  
  78. function ForceAngle(Joint, Angle, Character)
  79. if Character == nil then return false end
  80. local Joints = {
  81. Character.Torso:FindFirstChild("Right Shoulder 2"),
  82. Character.Torso:FindFirstChild("Left Shoulder 2"),
  83. Character.Torso:FindFirstChild("Right Hip 2"),
  84. Character.Torso:FindFirstChild("Left Hip 2")
  85. }
  86. if Joints[Joint] == nil then return false end
  87. if Joint == 1 or Joint == 3 then
  88. Joints[Joint].DesiredAngle = Angle
  89. Joints[Joint].CurrentAngle = Angle
  90. end
  91. if Joint == 2 or Joint == 4 then
  92. Joints[Joint].DesiredAngle = -Angle
  93. Joints[Joint].CurrentAngle = -Angle
  94. end
  95. end
  96.  
  97.  
  98. function SetSpeed(Joint, Speed, Character)
  99. if Character == nil then return false end
  100. local Joints = {
  101. Character.Torso:FindFirstChild("Right Shoulder 2"),
  102. Character.Torso:FindFirstChild("Left Shoulder 2"),
  103. Character.Torso:FindFirstChild("Right Hip 2"),
  104. Character.Torso:FindFirstChild("Left Hip 2")
  105. }
  106. if Joints[Joint] == nil then return false end
  107. Joints[Joint].MaxVelocity = Speed
  108. end
  109.  
  110.  
  111. function DisableLimb(Limb, Character)
  112. if Character == nil then return false end
  113. if Character:FindFirstChild("Torso") == nil then return false end
  114. local Joints = {
  115. Character.Torso:FindFirstChild("Right Shoulder"),
  116. Character.Torso:FindFirstChild("Left Shoulder"),
  117. Character.Torso:FindFirstChild("Right Hip"),
  118. Character.Torso:FindFirstChild("Left Hip")
  119. }
  120. local Limbs = {
  121. Character:FindFirstChild("Right Arm"),
  122. Character:FindFirstChild("Left Arm"),
  123. Character:FindFirstChild("Right Leg"),
  124. Character:FindFirstChild("Left Leg")
  125. }
  126. if Joints[Limb] == nil then return false end
  127. if Limbs[Limb] == nil then return false end
  128. local Joint = Instance.new("Motor")
  129. Joint.Parent = Character.Torso
  130. Joint.Part0 = Character.Torso
  131. Joint.Part1 = Limbs[Limb]
  132. if Limb == 1 then
  133. Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  134. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  135. Joint.Name = "Right Shoulder 2"
  136. elseif Limb == 2 then
  137. Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  138. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  139. Joint.Name = "Left Shoulder 2"
  140. elseif Limb == 3 then
  141. Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  142. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  143. Joint.Name = "Right Hip 2"
  144. elseif Limb == 4 then
  145. Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  146. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  147. Joint.Name = "Left Hip 2"
  148. end
  149. Joint.MaxVelocity = Joints[Limb].MaxVelocity
  150. Joint.CurrentAngle = Joints[Limb].CurrentAngle
  151. Joint.DesiredAngle = Joints[Limb].DesiredAngle
  152. Joints[Limb]:Remove()
  153. end
  154.  
  155.  
  156. function ResetLimbCFrame(Limb, Character)
  157. if Character == nil then return false end
  158. if Character.Parent == nil then return false end
  159. if Character:FindFirstChild("Torso") == nil then return false end
  160. local Joints = {
  161. Character.Torso:FindFirstChild("Right Shoulder 2"),
  162. Character.Torso:FindFirstChild("Left Shoulder 2"),
  163. Character.Torso:FindFirstChild("Right Hip 2"),
  164. Character.Torso:FindFirstChild("Left Hip 2")
  165. }
  166. local Limbs = {
  167. Character:FindFirstChild("Right Arm"),
  168. Character:FindFirstChild("Left Arm"),
  169. Character:FindFirstChild("Right Leg"),
  170. Character:FindFirstChild("Left Leg")
  171. }
  172. if Joints[Limb] == nil then return false end
  173. if Limbs[Limb] == nil then return false end
  174. if Limb == 1 then
  175. Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  176. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  177. elseif Limb == 2 then
  178. Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  179. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  180. elseif Limb == 3 then
  181. Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  182. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  183. elseif Limb == 4 then
  184. Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  185. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  186. end
  187. end
  188.  
  189.  
  190. function EnableLimb(Limb, Character)
  191. if Character == nil then return false end
  192. if Character:FindFirstChild("Torso") == nil then return false end
  193. local Joints = {
  194. Character.Torso:FindFirstChild("Right Shoulder 2"),
  195. Character.Torso:FindFirstChild("Left Shoulder 2"),
  196. Character.Torso:FindFirstChild("Right Hip 2"),
  197. Character.Torso:FindFirstChild("Left Hip 2")
  198. }
  199. local Limbs = {
  200. Character:FindFirstChild("Right Arm"),
  201. Character:FindFirstChild("Left Arm"),
  202. Character:FindFirstChild("Right Leg"),
  203. Character:FindFirstChild("Left Leg")
  204. }
  205. if Joints[Limb] == nil then return false end
  206. if Limbs[Limb] == nil then return false end
  207. if Limb == 1 then
  208. Joints[Limb].Name = "Right Shoulder"
  209. elseif Limb == 2 then
  210. Joints[Limb].Name = "Left Shoulder"
  211. elseif Limb == 3 then
  212. Joints[Limb].Name = "Right Hip"
  213. elseif Limb == 4 then
  214. Joints[Limb].Name = "Left Hip"
  215. end
  216. Animate = Character:FindFirstChild("Animate")
  217. if Animate == nil then return false end
  218. Animate = Animate:Clone()
  219. Character.Animate:Remove()
  220. Animate.Parent = Character
  221. end
  222.  
  223.  
  224. function Weld(x, y)
  225. local weld = Instance.new("Weld")
  226. weld.Part0 = x
  227. weld.Part1 = y
  228. CJ = CFrame.new(x.Position)
  229. C0 = x.CFrame:inverse() * CJ
  230. C1 = y.CFrame:inverse() * CJ
  231. weld.C0 = C0
  232. weld.C1 = C1
  233. weld.Parent = x
  234. end
  235.  
  236.  
  237. function tagHumanoid(humanoid)
  238. local tag = Instance.new("ObjectValue")
  239. tag.Name = "creator"
  240. tag.Value = Player
  241. tag.Parent = humanoid
  242. local tag = Instance.new("StringValue")
  243. tag.Name = "creatorType1"
  244. tag.Value = Name
  245. tag.Parent = humanoid
  246. local tag = Instance.new("StringValue")
  247. tag.Name = "creatorType2"
  248. tag.Value = "killed with magic"
  249. tag.Parent = humanoid
  250. end
  251.  
  252.  
  253. function untagHumanoid(humanoid)
  254. if humanoid ~= nil then
  255. local tag = humanoid:FindFirstChild("creator")
  256. if tag ~= nil then
  257. tag:Remove()
  258. end
  259. local tag = humanoid:FindFirstChild("creatorType1")
  260. if tag ~= nil then
  261. tag:Remove()
  262. end
  263. local tag = humanoid:FindFirstChild("creatorType2")
  264. if tag ~= nil then
  265. tag:Remove()
  266. end
  267. end
  268. end
  269.  
  270.  
  271. function onButton1Down(mouse)
  272. if selected == false or canFire == false then return end
  273. if Player.Character == nil then return end
  274. if Player.Character:FindFirstChild("Humanoid") == nil then return end
  275. if Player.Character.Humanoid.Health <= 0 then return end
  276. if Player.Character:FindFirstChild(Name) == nil then return end
  277. if Player.Character[Name]:FindFirstChild("Handle") == nil then return end
  278. if mouse == nil then return end
  279. Button1Down = true
  280. if spell == 1 then
  281. canFire = false
  282. SetAngle(2, math.rad(-45), Player.Character)
  283. local charge = Instance.new("Part")
  284. charge.FormFactor = "Custom"
  285. charge.Size = Vector3.new(1, 1, 1)
  286. charge.CanCollide = false
  287. charge.Transparency = 1
  288. charge.TopSurface = 0
  289. charge.BottomSurface = 0
  290. charge.Parent = Player.Character
  291. local fire = Instance.new("Fire")
  292. fire.Parent = charge
  293. fire.Color = Color3.new(1,1,1)
  294. fire.Size = 2.5
  295. fire.Heat = -2.5
  296. local weld = Instance.new("Weld")
  297. weld.Part0 = charge
  298. weld.Part1 = Player.Character["Left Arm"]
  299. weld.C0 = CFrame.new(0, 1.1, 0)
  300. weld.Parent = charge
  301. wait(0.5)
  302. SetAngle(2, math.rad(160), Player.Character)
  303. for i = 1, 50 do
  304. coroutine.resume(coroutine.create(function()
  305. local b = Instance.new("Part", Workspace)
  306. b.FormFactor = "Custom"
  307. b.Size = Vector3.new(1, 1, 1)
  308. b.CanCollide = false
  309. b.BrickColor = BrickColor.new("Really black")
  310. b.TopSurface = 0
  311. b.BottomSurface = 0
  312. b.RotVelocity = Vector3.new(math.random(-50, 50), math.random(-50, 50), math.random(-50, 50))
  313. b.CFrame = Player.Character.Torso.CFrame * CFrame.new(math.random(-15, 15), 0, math.random(-15, 15)) * CFrame.fromEulerAnglesXYZ(math.rad(math.random(0, 360)), math.rad(math.random(0, 360)), math.rad(math.random(0, 360)))
  314. b:BreakJoints()
  315. local M = Instance.new("BodyVelocity")
  316. M.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  317. M.velocity = Vector3.new(0, 15, 0)
  318. M.Parent = b
  319. wait(3)
  320. M.velocity = Vector3.new(0, 0, 0)
  321. wait(2)
  322. M.velocity = Vector3.new(0, math.random(-100, -75), 0)
  323. while b.Position.y > Player.Character.Torso.Position.y do wait() end
  324. P = Instance.new("Part")
  325. P.Parent = Workspace
  326. P.FormFactor = "Custom"
  327. P.Size = Vector3.new(8, 8, 8)
  328. P.BrickColor = BrickColor.new("Really red")
  329. P.Anchored = true
  330. P.TopSurface = 0
  331. P.BottomSurface = 0
  332. P.CFrame = CFrame.new(b.Position)
  333. P.Transparency = math.random(2, 5) / 10
  334. local m = Instance.new("SpecialMesh")
  335. m.Parent = P
  336. m.MeshType = "Sphere"
  337. m.Scale = Vector3.new(math.random(10, 15) / 10, math.random(10, 15) / 10, math.random(10, 15) / 10)
  338. P.Touched:connect(function(hit)
  339. if hit.Parent ~= Player.Character then
  340. hit:BreakJoints()
  341. end
  342. end)
  343. game:GetService("Debris"):AddItem(b, 8)
  344. game:GetService("Debris"):AddItem(P, 10)
  345. end))
  346. wait(math.random(1, 25) / 100)
  347. end
  348. charge.Fire.Enabled = false
  349. SetAngle(2, math.rad(-10), Player.Character)
  350. wait(1)
  351. charge:Remove()
  352. canFire = true
  353. end
  354. end
  355.  
  356.  
  357. function onButton1Up(mouse)
  358. if selected == false then return end
  359. Button1Down = false
  360. while canFire == false do wait() end
  361. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  362. end
  363.  
  364.  
  365. function onKeyDown(key, mouse)
  366. if selected == false or canFire == false or Button1Down == true then return end
  367. key = key:lower()
  368. if key == "q" then
  369. if mouse.Target == nil then return end
  370. if game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent) ~= nil then
  371. onDeselected(mouse)
  372. script.Parent.Parent = game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent).Backpack
  373. end
  374. end
  375. if key == "e" then
  376. spell = spell - 1
  377. if spell < 1 then
  378. spell = 2
  379. end
  380. end
  381. if key == "r" then
  382. spell = spell + 1
  383. if spell > 2 then
  384. spell = 1
  385. end
  386. end
  387. if key == "e" or key == "r" then
  388. local Message = Instance.new("Message", Player.PlayerGui)
  389. if spell == 1 then
  390. Message.Text = "Rise and Fall"
  391. elseif spell == 2 then
  392. Message.Text = "Second spell, anyone?"
  393. end
  394. delay(2.5, function() Message:Remove() end)
  395. end
  396. end
  397.  
  398.  
  399. function onSelected(mouse)
  400. if selected == true then return end
  401. selected = true
  402. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  403. while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  404. if Player.Character.WeaponActivated.Value == nil then break end
  405. if Player.Character.WeaponActivated.Value.Parent == nil then break end
  406. wait()
  407. end
  408. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  409. makeParts()
  410. local weapon = Instance.new("ObjectValue")
  411. weapon.Name = "WeaponActivated"
  412. weapon.Value = script.Parent
  413. weapon.Parent = Player.Character
  414. DisableLimb(1, Player.Character)
  415. DisableLimb(2, Player.Character)
  416. pcall(function() Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.25, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(140), 0) end)
  417. pcall(function() Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0) end)
  418. SetAngle(1, math.rad(75), Player.Character)
  419. SetAngle(2, math.rad(-10), Player.Character)
  420. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  421. mouse.Button1Up:connect(function() onButton1Up(mouse) end)
  422. mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end)
  423. end
  424.  
  425.  
  426. function onDeselected(mouse)
  427. if selected == false then return end
  428. selected = false
  429. Button1Down = false
  430. while canFire == false do
  431. wait()
  432. end
  433. if Player.Character:FindFirstChild("WeaponActivated") ~= nil then
  434. if Player.Character.WeaponActivated.Value == script.Parent then
  435. Player.Character.WeaponActivated:Remove()
  436. end
  437. end
  438. while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  439. if Player.Character.WeaponActivated.Value == nil then break end
  440. if pcall(function() if Player.Character.WeaponActivated.Value.Parent == nil then return true end end) then break end
  441. wait()
  442. end
  443. if Player.PlayerGui:FindFirstChild(Name) ~= nil then Player.PlayerGui[Name]:Remove() end
  444. removeParts()
  445. SetAngle(1, 0, Player.Character)
  446. ResetLimbCFrame(1, Player.Character)
  447. EnableLimb(1, Player.Character)
  448. EnableLimb(2, Player.Character)
  449. end
  450.  
  451.  
  452. if script.Parent.ClassName ~= "HopperBin" then
  453. if Player == nil then print("Error: Player not found!") return end
  454. Tool = Instance.new("HopperBin")
  455. Tool.Name = Name
  456. Tool.Parent = Player.Backpack
  457. script.Name = "Main"
  458. script.Parent = Tool
  459. end wait() if script.Parent.ClassName == "HopperBin" then
  460. while script.Parent.Parent.ClassName ~= "Backpack" do
  461. wait()
  462. end
  463. Player = script.Parent.Parent.Parent
  464. script.Parent.Selected:connect(onSelected)
  465. script.Parent.Deselected:connect(onDeselected)
  466. end
Add Comment
Please, Sign In to add comment