Advertisement
Axprotss

Earth Powers

May 30th, 2021
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.96 KB | None | 0 0
  1. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  2. local Player,game,owner = owner,game
  3. local RealPlayer = Player
  4. do
  5.     print("FE Compatibility code by Mokiros")
  6.     local rp = RealPlayer
  7.     script.Parent = rp.Character
  8.    
  9.     --RemoteEvent for communicating
  10.     local Event = Instance.new("RemoteEvent")
  11.     Event.Name = "UserInput_Event"
  12.  
  13.     --Fake event to make stuff like Mouse.KeyDown work
  14.     local function fakeEvent()
  15.         local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end}
  16.         t.connect = t.Connect
  17.         return t
  18.     end
  19.  
  20.     --Creating fake input objects with fake variables
  21.     local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  22.     local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  23.     local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  24.         CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  25.     end}
  26.     --Merged 2 functions into one by checking amount of arguments
  27.     CAS.UnbindAction = CAS.BindAction
  28.  
  29.     --This function will trigger the events that have been :Connect()'ed
  30.     local function te(self,ev,...)
  31.         local t = m[ev]
  32.         if t and t._fakeEvent then
  33.             for _,f in pairs(t.Functions) do
  34.                 f(...)
  35.             end
  36.         end
  37.     end
  38.     m.TrigEvent = te
  39.     UIS.TrigEvent = te
  40.  
  41.     Event.OnServerEvent:Connect(function(plr,io)
  42.         if plr~=rp then return end
  43.         m.Target = io.Target
  44.         m.Hit = io.Hit
  45.         if not io.isMouse then
  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 Mouse = Player:GetMouse()
  66.     local UIS = game:GetService("UserInputService")
  67.     local input = function(io,a)
  68.         if a then return end
  69.         --Since InputObject is a client-side instance, we create and pass table instead
  70.         Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  71.     end
  72.     UIS.InputBegan:Connect(input)
  73.     UIS.InputEnded:Connect(input)
  74.  
  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.  
  85.     ----Sandboxed game object that allows the usage of client-side methods and services
  86.     --Real game object
  87.     local _rg = game
  88.  
  89.     --Metatable for fake service
  90.     local fsmt = {
  91.         __index = function(self,k)
  92.             local s = rawget(self,"_RealService")
  93.             if s then return s[k] end
  94.         end,
  95.         __newindex = function(self,k,v)
  96.             local s = rawget(self,"_RealService")
  97.             if s then s[k]=v end
  98.         end,
  99.         __call = function(self,...)
  100.             local s = rawget(self,"_RealService")
  101.             if s then return s(...) end
  102.         end
  103.     }
  104.     local function FakeService(t,RealService)
  105.         t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService
  106.         return setmetatable(t,fsmt)
  107.     end
  108.  
  109.     --Fake game object
  110.     local g = {
  111.         GetService = function(self,s)
  112.             return self[s]
  113.         end,
  114.         Players = FakeService({
  115.             LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
  116.         },"Players"),
  117.         UserInputService = FakeService(UIS,"UserInputService"),
  118.         ContextActionService = FakeService(CAS,"ContextActionService"),
  119.     }
  120.     rawset(g.Players,"localPlayer",g.Players.LocalPlayer)
  121.     g.service = g.GetService
  122.    
  123.     g.RunService = FakeService({
  124.         RenderStepped = _rg:GetService("RunService").Heartbeat,
  125.         BindToRenderStep = function(self,name,_,fun)
  126.             self._btrs[name] = self.Heartbeat:Connect(fun)
  127.         end,
  128.         UnbindFromRenderStep = function(self,name)
  129.             self._btrs[name]:Disconnect()
  130.         end,
  131.     },"RunService")
  132.  
  133.     setmetatable(g,{
  134.         __index=function(self,s)
  135.             return _rg:GetService(s) or typeof(_rg[s])=="function"
  136.             and function(_,...)return _rg[s](_rg,...)end or _rg[s]
  137.         end,
  138.         __newindex = fsmt.__newindex,
  139.         __call = fsmt.__call
  140.     })
  141.     --Changing owner to fake player object to support owner:GetMouse()
  142.     game,owner = g,g.Players.LocalPlayer
  143. end
  144.  
  145. player = game:service("Players").LocalPlayer
  146. char = player.Character
  147. fdown = false
  148. rdown = false
  149. qdown = false
  150. suit = Instance.new("Model", char)
  151. suit.Name = "Suit"
  152. --[[
  153. for i,v in pairs(char:GetChildren()) do
  154.  if v.Name ~= "Head" and v.className == "Part" then
  155.   local bp = Instance.new("Part", suit)
  156.   bp.Name = v.Name
  157.   bp.TopSurface = "Smooth"
  158.   bp.BottomSurface = "Smooth"
  159.   bp.CanCollide = false
  160.   bp.FormFactor = "Custom"
  161.   bp.Size = v.Size
  162.   bp.Material = "Grass"
  163.   local bw = Instance.new("Motor6D", bp)
  164.   bw.Part1 = bp
  165.   bw.Part0 = v
  166.  end
  167. end
  168. ]]
  169. hb = Instance.new("HopperBin", player.Backpack)
  170. hb.Name = "Magic"
  171. function fkey()
  172.  local ps = Instance.new("Part", workspace)
  173.  ps.Name = "MagicPart"
  174.  ps.TopSurface = "Smooth"
  175.  ps.BottomSurface = "Smooth"
  176.  ps.BrickColor = BrickColor.new("Dark green")
  177.  ps.Material = "Grass"
  178.  ps.FormFactor = "Custom"
  179.  ps.Size =  Vector3.new(6, 0.2, 6)
  180.  ps.Anchored = true
  181.  ps.CFrame = char.Torso.CFrame*CFrame.new(0, -3, 0)
  182.  local i = 0
  183.  while fdown == true do
  184.   wait(0.03)
  185.   i = i + 1
  186.   ps.CFrame = ps.CFrame*CFrame.new(0, 0.1, 0)
  187.   local ts = ps.CFrame
  188.   ps.Size = Vector3.new(6, i*0.2, 6)
  189.   ps.CFrame = ts
  190.  end
  191.  coroutine.resume(coroutine.create(function()
  192.   wait(40)
  193.   ps:remove()
  194.  end))
  195. end
  196. function rkey()
  197.  local ps = Instance.new("Part", workspace)
  198.  ps.Name = "MagicPart"
  199.  ps.TopSurface = "Smooth"
  200.  ps.BottomSurface = "Smooth"
  201.  ps.BrickColor = BrickColor.new("Dark green")
  202.  ps.Material = "Grass"
  203.  ps.FormFactor = "Custom"
  204.  ps.Size =  Vector3.new(6, 0.2, 6)
  205.  ps.Anchored = true
  206.  ps.CFrame = char.Torso.CFrame*CFrame.new(0, -6, -6)*CFrame.Angles(-10, 0, 0)
  207.  local i = 0
  208.  while rdown == true do
  209.   wait(0.03)
  210.   i = i + 1
  211.   ps.CFrame = ps.CFrame*CFrame.new(0, -0.1, 0)
  212.   local ts = ps.CFrame
  213.   ps.Size = Vector3.new(6, i*0.2, 6)
  214.   ps.CFrame = ts
  215.  end
  216.  coroutine.resume(coroutine.create(function()
  217.   wait(40)
  218.   ps:remove()
  219.  end))
  220. end
  221. function tkey()
  222.  local ps = Instance.new("Part", workspace)
  223.  ps.Name = "MagicPart"
  224.  ps.TopSurface = "Smooth"
  225.  ps.BottomSurface = "Smooth"
  226.  ps.BrickColor = BrickColor.new("Dark green")
  227.  ps.Material = "Grass"
  228.  ps.FormFactor = "Custom"
  229.  ps.Size = Vector3.new(40, 30, 6)
  230.  ps.Anchored = true
  231.  ps.CFrame = char.Torso.CFrame*CFrame.new(0, 8, -15)*CFrame.Angles(-10, 0, 0)
  232.  coroutine.resume(coroutine.create(function()
  233.   wait(40)
  234.   ps:remove()
  235.  end))
  236.  for i = 1, 300 do
  237.   wait()
  238.   ps.CFrame = ps.CFrame*CFrame.new(0, -0.4, 0.7)
  239.  end
  240. end
  241. function ykey()
  242.  local ps = Instance.new("Part", workspace)
  243.  ps.Name = "MagicPart"
  244.  ps.TopSurface = "Smooth"
  245.  ps.BottomSurface = "Smooth"
  246.  ps.BrickColor = BrickColor.new("Dark green")
  247.  ps.Material = "Grass"
  248.  ps.FormFactor = "Custom"
  249.  ps.Size = Vector3.new(40, 30, 6)
  250.  ps.Anchored = true
  251.  ps.CFrame = char.Torso.CFrame*CFrame.new(0, 8, -15)*CFrame.Angles(-10, 0, 0)
  252.  coroutine.resume(coroutine.create(function()
  253.   wait(40)
  254.   ps:remove()
  255.  end))
  256. end
  257. function ukey()
  258.  for i = 1, 40 do
  259.   local ps = Instance.new("Part", workspace)
  260.   ps.Name = "MagicPart"
  261.   ps.TopSurface = "Smooth"
  262.   ps.BottomSurface = "Smooth"
  263.   ps.BrickColor = BrickColor.new("Dark green")
  264.   ps.Material = "Grass"
  265.   ps.FormFactor = "Custom"
  266.   ps.Size = Vector3.new(40, 30, 6)
  267.   ps.Anchored = true
  268.   ps.CFrame = char.Torso.CFrame*CFrame.Angles(0, i*5, 0)
  269.   ps.CFrame = ps.CFrame*CFrame.Angles(-10, 0, 0)
  270.   coroutine.resume(coroutine.create(function()
  271.    wait(40)
  272.    ps:remove()
  273.   end))
  274.   coroutine.resume(coroutine.create(function()
  275.    for i = 1, 300 do
  276.     wait()
  277.     ps.CFrame = ps.CFrame*CFrame.new(0, -0.4, 0.7)
  278.    end
  279.   end))
  280.  end
  281. end
  282. function qkey()
  283.  while qdown == true do
  284.   wait(0.03)
  285.   local ps = Instance.new("Part", workspace)
  286.   ps.Name = "MagicPart"
  287.   ps.TopSurface = "Smooth"
  288.   ps.BottomSurface = "Smooth"
  289.   ps.BrickColor = BrickColor.new("Dark green")
  290.   ps.Material = "Grass"
  291.   ps.FormFactor = "Custom"
  292.   ps.Size =  Vector3.new(6, 0.2, 6)
  293.   ps.Anchored = true
  294.   ps.CFrame = char.Torso.CFrame*CFrame.new(0, -3, 0)
  295.  end
  296.  coroutine.resume(coroutine.create(function()
  297.   wait(40)
  298.   ps:remove()
  299.  end))
  300. end
  301. hb.Selected:connect(function(mouse)
  302.  mouse.KeyUp:connect(function(key)
  303.   if key == "f" then
  304.    fdown = false
  305.   elseif key == "r" then
  306.    rdown = false
  307.   end
  308.  end)
  309.  mouse.KeyDown:connect(function(key)
  310.   if key == "f" then
  311.    fdown = true
  312.    fkey()
  313.   elseif key == "r" then
  314.    rdown = true
  315.    rkey()
  316.   elseif key == "t" then
  317.    tkey()
  318.   elseif key == "u" then
  319.    ukey()
  320.   elseif key == "y" then
  321.    ykey()
  322.   elseif key == "q" then
  323.    if qdown == false then
  324.     qdown = true
  325.     qkey()
  326.    else
  327.     qdown = false
  328.    end
  329.   end
  330.  end)
  331. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement