Advertisement
Guest User

fdgdfhdfg

a guest
May 21st, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.84 KB | None | 0 0
  1. -- This script has been converted to FE by iPxter
  2.  
  3.  
  4. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  5. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  6. do
  7. print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
  8. script.Parent = Player.Character
  9.  
  10. --RemoteEvent for communicating
  11. local Event = Instance.new("RemoteEvent")
  12. Event.Name = "UserInput_Event"
  13.  
  14. --Fake event to make stuff like Mouse.KeyDown work
  15. local function fakeEvent()
  16. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  17. t.connect = t.Connect
  18. return t
  19. end
  20.  
  21. --Creating fake input objects with fake variables
  22. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  23. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  24. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  25. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  26. end}
  27. --Merged 2 functions into one by checking amount of arguments
  28. CAS.UnbindAction = CAS.BindAction
  29.  
  30. --This function will trigger the events that have been :Connect()'ed
  31. local function te(self,ev,...)
  32. local t = m[ev]
  33. if t and t._fakeEvent and t.Function then
  34. t.Function(...)
  35. end
  36. end
  37. m.TrigEvent = te
  38. UIS.TrigEvent = te
  39.  
  40. Event.OnServerEvent:Connect(function(plr,io)
  41. if plr~=Player then return end
  42. if io.isMouse then
  43. m.Target = io.Target
  44. m.Hit = io.Hit
  45. else
  46. local b = io.UserInputState == Enum.UserInputState.Begin
  47. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  48. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  49. end
  50. for _,t in pairs(CAS.Actions) do
  51. for _,k in pairs(t.Keys) do
  52. if k==io.KeyCode then
  53. t.Function(t.Name,io.UserInputState,io)
  54. end
  55. end
  56. end
  57. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  58. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  59. end
  60. end)
  61. Event.Parent = NLS([==[
  62. local Player = game:GetService("Players").LocalPlayer
  63. local Event = script:WaitForChild("UserInput_Event")
  64.  
  65. local UIS = game:GetService("UserInputService")
  66. local input = function(io,a)
  67. if a then return end
  68. --Since InputObject is a client-side instance, we create and pass table instead
  69. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  70. end
  71. UIS.InputBegan:Connect(input)
  72. UIS.InputEnded:Connect(input)
  73.  
  74. local Mouse = Player:GetMouse()
  75. local h,t
  76. --Give the server mouse data 30 times every second, but only if the values changed
  77. --If player is not moving their mouse, client won't fire events
  78. while wait(1/30) do
  79. if h~=Mouse.Hit or t~=Mouse.Target then
  80. h,t=Mouse.Hit,Mouse.Target
  81. Event:FireServer({isMouse=true,Target=t,Hit=h})
  82. end
  83. end]==],Player.Character)
  84. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  85. end
  86.  
  87. Modelname = "Staff Of Disasterous Explosions"
  88. Toolname = "Staff Of Disasterous Explosions"
  89. Surfaces = {"FrontSurface", "BackSurface", "TopSurface", "BottomSurface", "LeftSurface", "RightSurface"}
  90. local Selected = false
  91. local inuse = false
  92. local mousedown = false
  93. local Character = nil
  94.  
  95. function Execute(f)
  96. return coroutine.resume(coroutine.create(function()f()end))
  97. end
  98.  
  99. function Part(Parent, Anchor, Collide, Tran, Ref, Color, X, Y, Z, Break)
  100. local p = Instance.new("Part")
  101. p.formFactor = "Custom"
  102. p.Anchored = Anchor
  103. p.CanCollide = Collide
  104. p.Transparency = Tran
  105. p.Reflectance = Ref
  106. p.BrickColor = BrickColor.new(Color)
  107. p.Material = 272
  108.  
  109. for _, Surf in pairs(Surfaces) do
  110. p[Surf] = "Smooth"
  111. end
  112.  
  113. p.Size = Vector3.new(X, Y, Z)
  114.  
  115. if Break then
  116. p:BreakJoints()
  117. else
  118. p:MakeJoints()
  119. end
  120.  
  121. p.Parent = Parent
  122. p.Locked = true
  123.  
  124. return p
  125. end
  126.  
  127. function Weld(p0, p1, x, y, z, a, b, c)
  128. local w = Instance.new("Weld")
  129. w.Parent = p0
  130. w.Part0 = p0
  131. w.Part1 = p1
  132. w.C1 = CFrame.new(x,y,z) * CFrame.Angles(a,b,c)
  133. return w
  134. end
  135.  
  136. Add = {
  137. Sphere = function(P)
  138. local m = Instance.new("SpecialMesh",P)
  139. m.MeshType = "Sphere"
  140. return m
  141. end,
  142. Mesh = function(P, ID, x, y, z)
  143. local m = Instance.new("SpecialMesh")
  144. m.MeshId = ID
  145. m.Scale = Vector3.new(x, y, z)
  146. m.Parent = P
  147. return m
  148. end,
  149. Sound = function(P, ID, vol, pitch)
  150. local s = Instance.new("Sound")
  151. s.SoundId = ID
  152. s.Volume = vol
  153. s.Pitch = pitch
  154. s.Parent = P
  155. return s
  156. end
  157. }
  158.  
  159.  
  160. local Model,handle,toptip,bottip,HB,HW,TH,HBW,Crystal
  161. local player = owner
  162. local StaffModel = nil
  163. local Rarm = nil
  164. local RABrick, RABW, RAW
  165.  
  166. function GenerateModel(Parent,Torso,Rarm)
  167. Model = Instance.new("Model")
  168. Model.Name = Modelname
  169. handle = Part(Model, false, false, 0, 0, "Brown", 0.3, 4.4, 0.3, true)
  170. handle.Name = "Handle"
  171. Instance.new("CylinderMesh",handle)
  172. toptip = Part(Model, false, false, 0, 0, "Brown", 0.6, 0.2, 0.6, true)
  173. Weld(handle, toptip, 0, -2, 0, 0, 0, 0)
  174. Instance.new("CylinderMesh",toptip)
  175. Crystal = Part(Model, false, false, 0, 0.2, "Bright blue", 0.5, 0.75, 0.5, true)
  176. local w1 = Weld(handle, Crystal, 0, -2.2, 0, 0, 0, 0)
  177. Add.Mesh(Crystal, "http://www.roblox.com/asset/?id=9756362", 0.5, 0.75, 0.5)
  178. Crystal.Reflectance = 0.25
  179. Crystal.Transparency = 0.25
  180. local BotTip = Part(Model, false, false, 0, 0, "Brown", 0.2, 1.5, 0.2, true)
  181. local w1 = Weld(handle, BotTip, 0, 2.15, 0, 0, 0, 0)
  182. Add.Mesh(BotTip, "http://www.roblox.com/asset/?id=9756362", 0.4, 0.7, 0.4)
  183. Model.Parent = Parent
  184. StaffModel = Model
  185.  
  186. RABrick = Part(Model, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  187. RABW = Weld(Torso, RABrick, -1.5, -0.5, 0, 0, 0, 0)
  188. RAW = Weld(RABrick, nil, 0, 0.5, 0, 0, 0, 0)
  189.  
  190. HB = Part(Model, false, false, 1, 0, "White", 0.1, 0.1, 0.1, true)
  191. HBW = Weld(Rarm, HB, 0, 1, -1.5, 0, 0, 0)
  192. HW = Weld(HB, nil, 0, -1.3, 0, math.pi/2, 0, 0)
  193. TH = Weld(Torso, nil, -0.6, 0.1, 0, 0, math.pi/2, math.rad(-140))
  194. TH.Part1 = handle
  195.  
  196. end
  197.  
  198. local tool = nil
  199. function GenerateTool()
  200. if player:IsA("Player") then
  201. if player.Character ~= nil then
  202. if player.Character:FindFirstChild("Torso") ~= nil then
  203. if player.Character:FindFirstChild(Modelname) == nil then
  204. if player.Character:FindFirstChild("Right Arm") then
  205. GenerateModel(player.Character,player.Character:FindFirstChild("Torso"),player.Character:FindFirstChild("Right Arm"))
  206. Rarm = player.Character:FindFirstChild("Right Arm")
  207. Character = player.Character
  208. end
  209. else
  210. StaffModel = player.Character:FindFirstChild(Modelname)
  211. end
  212. if player.Character:FindFirstChild(Modelname) ~= nil then
  213. if player.Backpack:FindFirstChild(Toolname) == nil then
  214. tool = Instance.new("HopperBin",player.Backpack)
  215. tool.Name = Toolname
  216. wait()
  217. script.Parent = tool
  218. end
  219. end
  220. end
  221. end
  222. end
  223. end
  224.  
  225. function ToolAnimSelect()
  226. RAW.Part1 = Rarm
  227. local ah = CFrame.Angles(0, 0, math.rad(90))
  228. RAW.Part1 = Rarm
  229. for i = 0, 270, 270/5 do
  230. RAW.C0 = CFrame.new(0, 0, -i/500) * CFrame.Angles(math.rad(i), math.rad(i/4), 0)
  231. wait()
  232. end
  233. HW.C0 = ah
  234. TH.Part1 = nil
  235. HW.Part1 = handle
  236. for i = 270, 70, -200/5 do
  237. RAW.C0 = CFrame.new(0, 0, -i/500) * CFrame.Angles(math.rad(i), math.rad(i/4), 0)
  238. wait()
  239. end
  240. RAW.C0 = CFrame.new(0, 0, -70/500) * CFrame.Angles(70,0,0)
  241. inuse = false
  242. end
  243.  
  244. function ToolAnimUnSelect()
  245. RAW.Part1 = Rarm
  246. local ah = CFrame.Angles(0, 0, math.rad(90))
  247. for i = 70, 270, 200/5 do
  248. RAW.C0 = CFrame.new(0, 0, -i/500) * CFrame.Angles(math.rad(i), math.rad(i/4), 0)
  249. wait()
  250. end
  251. HW.C0 = ah
  252. HW.Part1 = nil
  253. TH.Part1 = handle
  254. for i = 270, 0, -270/5 do
  255. RAW.C0 = CFrame.new(0, 0, -i/500) * CFrame.Angles(math.rad(i), math.rad(i/4), 0)
  256. wait()
  257. end
  258. RAW.Part1 = nil
  259. inuse = false
  260. end
  261.  
  262. function prop(part, parent, collide, tran, ref, x, y, z, color)
  263. part.Parent = parent
  264. part.formFactor = 3
  265. part.Anchored = true
  266. part.CanCollide = collide
  267. part.Transparency = tran
  268. part.Reflectance = ref
  269. part.Material = 288
  270. part.Size = Vector3.new(x,y,z)
  271. part.BrickColor = BrickColor.new(color)
  272. part.TopSurface = 0
  273. part.BottomSurface = 0
  274. part:BreakJoints()
  275. end
  276.  
  277. local a,b,c -- explosion
  278. function Selected(mouse)
  279. if inuse == false then
  280. inuse = true
  281. ToolAnimSelect()
  282. Selected = true
  283. end
  284. if Selected == true then
  285. mouse.Button1Down:connect(function()
  286. mousedown = true
  287. while mousedown do
  288. if Character:FindFirstChild("Humanoid") ~= nil then
  289. if Character:FindFirstChild("Humanoid").Health > 0 then
  290. if Character:FindFirstChild("ForceField") == nil then
  291. c = Instance.new("ForceField",Character)
  292. end
  293. b = Instance.new("Part")
  294. prop(b, Character, false, 0.4, 0.25, 0.05, 0.05, (Crystal.Position - mouse.hit.p).magnitude, "Cyan")
  295. b.CFrame = CFrame.new(Crystal.Position, mouse.hit.p) * CFrame.new(0,0,-b.Size.Z/2)
  296. local ex = Instance.new("Explosion")
  297. ex.Parent = Character
  298. ex.DestroyJointRadiusPercent = 1
  299. ex.ExplosionType = 2
  300. ex.Position = mouse.hit.p
  301. ex.BlastRadius = 5
  302. ex.BlastPressure = 100000
  303. game:GetService("Debris"):AddItem(b,.25)
  304. end
  305. end
  306. wait(0.1)
  307.  
  308. end
  309. end)
  310. mouse.Button1Up:connect(function()
  311. if Character:FindFirstChild("ForceField") ~= nil then
  312. game:GetService("Debris"):AddItem(Character:FindFirstChild("ForceField"),.5)
  313. end
  314. mousedown = false
  315. end)
  316. end
  317. end
  318.  
  319.  
  320.  
  321.  
  322. function UnSelected()
  323. if inuse == false then
  324. if Character:FindFirstChild("ForceField") ~= nil then
  325. game:GetService("Debris"):AddItem(Character:FindFirstChild("ForceField"),.5)
  326. end
  327. mousedown = false
  328. inuse = true
  329. ToolAnimUnSelect()
  330. HW.Part1 = nil
  331. TH.Part1 = handle
  332. Selected = false
  333. end
  334. end
  335.  
  336. GenerateTool()
  337.  
  338. if tool ~= nil then
  339. tool.Selected:connect(Selected)
  340. tool.Deselected:connect(UnSelected)
  341. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement