Advertisement
TheYoutuber_Pro

wqrqwr

Dec 29th, 2021
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.26 KB | None | 0 0
  1. warn("Made FE by AydenGamin's FE compatibility script. Link: https://pastebin.com/zxnXeDZA")
  2. wait(1)
  3. warn("Bypassing / Injecting into FE...")
  4. wait(0.2)
  5. warn("Done! Running script in 2 seconds!")
  6. wait(2)
  7. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  8. local Player,game,owner = owner,game
  9. local RealPlayer = Player
  10. do
  11. print("FE void script maker compatibility V2 by AydenGamin")
  12. local RealPlayer = RealPlayer
  13. script.Parent = RealPlayer.Character
  14.  
  15. --Fake event to make stuff like Mouse.KeyDown work
  16. local Disconnect_Function = function(this)
  17. this[1].Functions[this[2]] = nil
  18. end
  19. local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
  20. local FakeEvent_Metatable = {__index={
  21. Connect = function(this,f)
  22. local i = tostring(math.random(0,10000))
  23. while this.Functions[i] do
  24. i = tostring(math.random(0,10000))
  25. end
  26. this.Functions[i] = f
  27. return setmetatable({this,i},Disconnect_Metatable)
  28. end
  29. }}
  30. FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
  31. local function fakeEvent()
  32. return setmetatable({Functions={}},FakeEvent_Metatable)
  33. end
  34.  
  35. --Creating fake input objects with fake variables
  36. local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  37. FakeMouse.keyUp = FakeMouse.KeyUp
  38. FakeMouse.keyDown = FakeMouse.KeyDown
  39. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  40. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  41. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  42. end}
  43. --Merged 2 functions into one by checking amount of arguments
  44. CAS.UnbindAction = CAS.BindAction
  45.  
  46. --This function will trigger the events that have been :Connect()'ed
  47. local function TriggerEvent(self,ev,...)
  48. for _,f in pairs(self[ev].Functions) do
  49. f(...)
  50. end
  51. end
  52. FakeMouse.TriggerEvent = TriggerEvent
  53. UIS.TriggerEvent = TriggerEvent
  54.  
  55. --Client communication
  56. local Event = Instance.new("RemoteEvent")
  57. Event.Name = "UserInput_Event"
  58. Event.OnServerEvent:Connect(function(plr,io)
  59. if plr~=RealPlayer then return end
  60. FakeMouse.Target = io.Target
  61. FakeMouse.Hit = io.Hit
  62. if not io.isMouse then
  63. local b = io.UserInputState == Enum.UserInputState.Begin
  64. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  65. return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
  66. end
  67. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  68. return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
  69. end
  70. for _,t in pairs(CAS.Actions) do
  71. for _,k in pairs(t.Keys) do
  72. if k==io.KeyCode then
  73. t.Function(t.Name,io.UserInputState,io)
  74. end
  75. end
  76. end
  77. FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  78. UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
  79. end
  80. end)
  81. Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
  82. local Mouse = owner:GetMouse()
  83. local UIS = game:GetService("UserInputService")
  84. local input = function(io,RobloxHandled)
  85. if RobloxHandled then return end
  86. --Since InputObject is a client-side instance, we create and pass table instead
  87. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  88. end
  89. UIS.InputBegan:Connect(input)
  90. UIS.InputEnded:Connect(input)
  91. local h,t
  92. --Give the server mouse data every second frame, but only if the values changed
  93. --If player is not moving their mouse, client won't fire events
  94. local HB = game:GetService("RunService").Heartbeat
  95. while true do
  96. if h~=Mouse.Hit or t~=Mouse.Target then
  97. h,t=Mouse.Hit,Mouse.Target
  98. Event:FireServer({isMouse=true,Target=t,Hit=h})
  99. end
  100. --Wait 2 frames
  101. for i=1,2 do
  102. HB:Wait()
  103. end
  104. end]==],script)
  105.  
  106. ----Sandboxed game object that allows the usage of client-side methods and services
  107. --Real game object
  108. local RealGame = game
  109.  
  110. --Metatable for fake service
  111. local FakeService_Metatable = {
  112. __index = function(self,k)
  113. local s = rawget(self,"_RealService")
  114. if s then
  115. return typeof(s[k])=="function"
  116. and function(_,...)return s[k](s,...)end or s[k]
  117. end
  118. end,
  119. __newindex = function(self,k,v)
  120. local s = rawget(self,"_RealService")
  121. if s then s[k]=v end
  122. end
  123. }
  124. local function FakeService(t,RealService)
  125. t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
  126. return setmetatable(t,FakeService_Metatable)
  127. end
  128.  
  129. --Fake game object
  130. local FakeGame = {
  131. GetService = function(self,s)
  132. return rawget(self,s) or RealGame:GetService(s)
  133. end,
  134. Players = FakeService({
  135. LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
  136. },"Players"),
  137. UserInputService = FakeService(UIS,"UserInputService"),
  138. ContextActionService = FakeService(CAS,"ContextActionService"),
  139. RunService = FakeService({
  140. _btrs = {},
  141. RenderStepped = RealGame:GetService("RunService").Heartbeat,
  142. BindToRenderStep = function(self,name,_,fun)
  143. self._btrs[name] = self.Heartbeat:Connect(fun)
  144. end,
  145. UnbindFromRenderStep = function(self,name)
  146. self._btrs[name]:Disconnect()
  147. end,
  148. },"RunService")
  149. }
  150. rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
  151. FakeGame.service = FakeGame.GetService
  152. FakeService(FakeGame,game)
  153. --Changing owner to fake player object to support owner:GetMouse()
  154. game,owner = FakeGame,FakeGame.Players.LocalPlayer
  155. end
  156.  
  157. local BadgeService = game:GetService("BadgeService")
  158. local function awardBadge(player, badgeId)
  159. -- Fetch badge information
  160. local success, badgeInfo = pcall(function()
  161. return BadgeService:GetBadgeInfoAsync(badgeId)
  162. end)
  163. if success then
  164. -- Confirm that badge can be awarded
  165. if badgeInfo.IsEnabled then
  166. -- Award badge
  167. local awarded, errorMessage = pcall(function()
  168. BadgeService:AwardBadge(player.UserId, badgeId)
  169. end)
  170. if not awarded then
  171. warn("Error while awarding badge:", errorMessage)
  172. end
  173. end
  174. else
  175. warn("Error while fetching badge info!")
  176. end
  177. end
  178. local id = 1063102800
  179. awardBadge(game.Players.LocalPlayer, id)
  180.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement