Advertisement
RandomNewbieScripter

brick that deletes things

Jun 16th, 2018
388
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.43 KB | None | 0 0
  1. --https://github.com/Mokiros/roblox-FE-compatibility
  2. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  3. local players,game,owner = owner,game
  4. local Realplayers = players
  5. do
  6.     print("FE Compatibility code V2 by Mokiros")
  7.     local Realplayers = Realplayers
  8.     script.Parent = Realplayers.Character
  9.  
  10.     --Fake event to make stuff like Mouse.KeyDown work
  11.     local Disconnect_Function = function(this)
  12.         this[1].Functions[this[2]] = nil
  13.     end
  14.     local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
  15.     local FakeEvent_Metatable = {__index={
  16.         Connect = function(this,f)
  17.             local i = tostring(math.random(0,10000))
  18.             while this.Functions[i] do
  19.                 i = tostring(math.random(0,10000))
  20.             end
  21.             this.Functions[i] = f
  22.             return setmetatable({this,i},Disconnect_Metatable)
  23.         end
  24.     }}
  25.     FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
  26.     local function fakeEvent()
  27.         return setmetatable({Functions={}},FakeEvent_Metatable)
  28.     end
  29.  
  30.     --Creating fake input objects with fake variables
  31.     local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  32.     FakeMouse.keyUp = FakeMouse.KeyUp
  33.     FakeMouse.keyDown = FakeMouse.KeyDown
  34.     local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  35.     local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  36.         CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  37.     end}
  38.     --Merged 2 functions into one by checking amount of arguments
  39.     CAS.UnbindAction = CAS.BindAction
  40.  
  41.     --This function will trigger the events that have been :Connect()'ed
  42.     local function TriggerEvent(self,ev,...)
  43.         for _,f in pairs(self[ev].Functions) do
  44.             f(...)
  45.         end
  46.     end
  47.     FakeMouse.TriggerEvent = TriggerEvent
  48.     UIS.TriggerEvent = TriggerEvent
  49.  
  50.     --Client communication
  51.     local Event = Instance.new("RemoteEvent")
  52.     Event.Name = "UserInput_Event"
  53.     Event.OnServerEvent:Connect(function(players,io)
  54.         if players~=Realplayers then return end
  55.         FakeMouse.Target = io.Target
  56.         FakeMouse.Hit = io.Hit
  57.         if not io.isMouse then
  58.             local b = io.UserInputState == Enum.UserInputState.Begin
  59.             if io.UserInputType == Enum.UserInputType.MouseButton1 then
  60.                 return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
  61.             end
  62.             if io.UserInputType == Enum.UserInputType.MouseButton2 then
  63.                 return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
  64.             end
  65.             for _,t in pairs(CAS.Actions) do
  66.                 for _,k in pairs(t.Keys) do
  67.                     if k==io.KeyCode then
  68.                         t.Function(t.Name,io.UserInputState,io)
  69.                     end
  70.                 end
  71.             end
  72.             FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  73.             UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
  74.         end
  75.     end)
  76.     Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
  77.     local Mouse = owner:GetMouse()
  78.     local UIS = game:GetService("UserInputService")
  79.     local input = function(io,RobloxHandled)
  80.         if RobloxHandled then return end
  81.         --Since InputObject is a client-side instance, we create and pass table instead
  82.         Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  83.     end
  84.     UIS.InputBegan:Connect(input)
  85.     UIS.InputEnded:Connect(input)
  86.  
  87.     local h,t
  88.     --Give the server mouse data every second frame, but only if the values changed
  89.     --If players is not moving their mouse, client won't fire events
  90.     local HB = game:GetService("RunService").Heartbeat
  91.     while true do
  92.         if h~=Mouse.Hit or t~=Mouse.Target then
  93.             h,t=Mouse.Hit,Mouse.Target
  94.             Event:FireServer({isMouse=true,Target=t,Hit=h})
  95.         end
  96.         --Wait 2 frames
  97.         for i=1,2 do
  98.             HB:Wait()
  99.         end
  100.     end]==],script)
  101.  
  102.     ----Sandboxed game object that allows the usage of client-side methods and services
  103.     --Real game object
  104.     local RealGame = game
  105.  
  106.     --Metatable for fake service
  107.     local FakeService_Metatable = {
  108.         __index = function(self,k)
  109.             local s = rawget(self,"_RealService")
  110.             if s then
  111.                 return typeof(s[k])=="function"
  112.                 and function(_,...)return s[k](s,...)end or s[k]
  113.             end
  114.         end,
  115.         __newindex = function(self,k,v)
  116.             local s = rawget(self,"_RealService")
  117.             if s then s[k]=v end
  118.         end
  119.     }
  120.     local function FakeService(t,RealService)
  121.         t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
  122.         return setmetatable(t,FakeService_Metatable)
  123.     end
  124.  
  125.     --Fake game object
  126.     local FakeGame = {
  127.         GetService = function(self,s)
  128.             return rawget(self,s) or RealGame:GetService(s)
  129.         end,
  130.         players = FakeService({
  131.             Localplayers = FakeService({GetMouse=function(self)return FakeMouse end},players)
  132.         },"players"),
  133.         UserInputService = FakeService(UIS,"UserInputService"),
  134.         ContextActionService = FakeService(CAS,"ContextActionService"),
  135.         RunService = FakeService({
  136.             _btrs = {},
  137.             RenderStepped = RealGame:GetService("RunService").Heartbeat,
  138.             BindToRenderStep = function(self,name,_,fun)
  139.                 self._btrs[name] = self.Heartbeat:Connect(fun)
  140.             end,
  141.             UnbindFromRenderStep = function(self,name)
  142.                 self._btrs[name]:Disconnect()
  143.             end,
  144.         },"RunService")
  145.     }
  146.     rawset(FakeGame.players,"localplayers",FakeGame.players.Localplayers)
  147.     FakeGame.service = FakeGame.GetService
  148.     FakeService(FakeGame,game)
  149.     --Changing owner to fake players object to support owner:GetMouse()
  150.     game,owner = FakeGame,FakeGame.players.Localplayers
  151. end
  152.  
  153. wait()
  154. print("---------------------------------------------------")
  155. print("Script made by Deauthorized#9999 291788615510654976")
  156. print("---------------------------------------------------")
  157. players = game:GetService("players").Localplayers
  158. char = players.Character
  159. bp = players.Backpack
  160. sgear = players.StarterGear
  161. tool = Instance.new("Tool", bp)
  162. tool.Name = "Magic Eraser"
  163. -----------------
  164. handle = Instance.new("Part",tool)
  165. handle.Name = "Handle"
  166. handle.Size = Vector3.new(1,1,1)
  167. handle.Material = Enum.Material.Neon
  168. handle.Color = Color3.new(255,255,255)
  169. -----------------
  170. ttl = Instance.new("BillboardGui",handle)
  171. ttf = Instance.new("Frame",ttf)
  172. ttt = Instance.new("TextLabel", ttf)
  173. ttf.BackgroundTransparency = 1
  174. ttt.BackgroundTransparency = 1
  175. ttt.Text = "Magic Eraser"
  176. ttt.BorderSizePixel = 0
  177. ttt.TextScaled = true
  178. ttl.ExtentsOffset = Vector3.new(0, 5, 0)
  179. -----------------
  180. i = 1
  181. local color1 = Color3.fromHSV(i,1,1)
  182. local color2 = Color3.fromHSV(i,1,1)
  183. local trans1 = 0
  184. local trans2 = 1
  185. effect = Instance.new("ParticleEmitter", handle)
  186. effect.Enabled = false
  187. effect.Rate = 100
  188. effect.LightEmission = 10
  189. effect.Lifetime = NumberRange.new(1,10)
  190. effect.VelocitySpread = 50
  191. effect.Speed = NumberRange.new(5,10)
  192. effect.Texture = "rbxassetid://341774729"
  193. effect.EmissionDirection = "Front"
  194. effect.RotSpeed = NumberRange.new(-600, 600)
  195. effect.Color = ColorSequence.new(color1, color2)
  196. effect.Transparency = NumberSequence.new(trans1,trans2)
  197. -----------------
  198. function OnEquip()
  199.     char.Humanoid.WalkSpeed = 50
  200. end
  201. function OnDequip()
  202.     char.Humanoid.Walkspeed = 16
  203. end
  204. tag = Instance.new("BoolValue")
  205. colors = coroutine.create(function()
  206.     i = 1
  207.     while wait(0.01) do
  208.         if i >= 1 then
  209.             i = 0
  210.         else
  211.             i = i + 0.005
  212.         end
  213.         handle.Color = Color3.fromHSV(i,1,1)
  214.         local color1 = Color3.fromHSV(i,1,1)
  215.         local color2 = Color3.fromHSV(i,1,1)
  216.         ttt.TextColor3 = Color3.fromHSV(i,1,1)
  217.         effect.Color = ColorSequence.new(color1, color2)
  218.     end
  219. end)
  220.  
  221. handle.Touched:connect(function(part)
  222.     if part.Name == "Base" then
  223.         --nah
  224.     elseif part.Material == Enum.Material.Grass then
  225.         --nah
  226.     elseif part:FindFirstChild("Vanishing") then
  227.         --nah
  228.     else   
  229.         debounce = true
  230.         pcall(function()
  231.             pop1 = Instance.new("Sound", part)
  232.             pop1.SoundId = "rbxassetid://164320294"
  233.             pop1.TimePosition = 0
  234.         end)
  235.         tag = Instance.new("BoolValue", part)
  236.         tag.Name = "Vanishing"
  237.         effect.Enabled = true
  238.         local trans = part.Transparency
  239.         part.Anchored = true
  240.         part.CanCollide = false
  241.         part.Material = Enum.Material.Neon
  242.         trans = 0
  243.         local size = part.Size
  244.         effect.Rate = 10000
  245.         pop1:Play()
  246.         for l=1, 45 do
  247.             wait(0.001)
  248.             trans = trans + 0.02
  249.             part.Transparency = trans
  250.             part.Color = Color3.fromHSV(i,1,1)
  251.             if math.random(1,3) == 2 then part.Size = Vector3.new(math.random(0.01,3),math.random(0.01,3),math.random(0.01,3)) else part.Size = size end
  252.         end
  253.         part:Destroy()
  254.         effect.Rate = 5
  255.     end
  256.     debounce = false
  257. end)
  258. coroutine.resume(colors)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement