Advertisement
uor

U can add on to this

uor
Oct 8th, 2019
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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 Player,game,owner = owner,game
  4. local RealPlayer = Player
  5. do
  6. print("FE Compatibility 1000hack")
  7. local RealPlayer = RealPlayer
  8. script.Parent = RealPlayer.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(),mouse.KeyUp:connect(function(key)
  32. if key == "z"then(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  33. FakeMouse.keyUp = FakeMouse.KeyUp
  34. FakeMouse.keyDown = FakeMouse.KeyDown
  35. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  36. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  37. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  38. end}
  39. --Merged 2 functions into one by checking amount of arguments
  40. CAS.UnbindAction = CAS.BindAction
  41.  
  42. --This function will trigger the events that have been :Connect()'ed
  43. local function TriggerEvent(self,ev,...)
  44. for _,f in pairs(self[ev].Functions) do
  45. f(...)
  46. end
  47. end
  48. FakeMouse.TriggerEvent = TriggerEvent
  49. UIS.TriggerEvent = TriggerEvent
  50.  
  51. --Client communication
  52. local Event = Instance.new("RemoteEvent")
  53. Event.Name = "UserInput_Event"
  54. Event.OnServerEvent:Connect(function(plr,io)
  55. if plr~=RealPlayer then return end
  56. FakeMouse.Target = io.Target
  57. FakeMouse.Hit = io.Hit
  58. if not io.isMouse then
  59. local b = io.UserInputState == Enum.UserInputState.Begin
  60. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  61. return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
  62. end
  63. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  64. return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
  65. end
  66. for _,t in pairs(CAS.Actions) do
  67. for _,k in pairs(t.Keys) do
  68. if k==io.KeyCode then
  69. t.Function(t.Name,io.UserInputState,io)
  70. end
  71. end
  72. end
  73. FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  74. UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
  75. end
  76. end)
  77. Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
  78. local Mouse = owner:GetMouse()
  79. local UIS = game:GetService("UserInputService")
  80. local input = function(io,RobloxHandled)
  81. if RobloxHandled then return end
  82. --Since InputObject is a client-side instance, we create and pass table instead
  83. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  84. end
  85. UIS.InputBegan:Connect(input)
  86. UIS.InputEnded:Connect(input)
  87. local h,t
  88. --Give the server mouse data every second frame, but only if the values changed
  89. --If player 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. LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
  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,"localPlayer",FakeGame.Players.LocalPlayer)
  147. FakeGame.service = FakeGame.GetService
  148. FakeService(FakeGame,game)
  149. --Changing owner to fake player object to support owner:GetMouse()
  150. game,owner = FakeGame,FakeGame.Players.LocalPlayer
  151. end
  152.  
  153. Colors = {"Really black", "Navy blue", "Really red", "Bright bluish green", "New Yeller", "Royal purple", "Deep orange", "Magenta", "Lime green"}
  154. Player = owner
  155. Char = Player.Character
  156. Torso = Char.Torso
  157.  
  158. pcall(function()Char.Platform:Destroy() end)
  159. Main = Instance.new("Model",Char)
  160. Main.Name = "Platform"
  161. script.Parent = Main
  162. Mode = 10
  163. Mode2 = 0
  164. With = 5 -- Must be 5 and larger. Idk why.
  165. Highth = .5
  166. OnColor = 1
  167.  
  168. MainP = Instance.new("Part",Main)
  169. MainP.FormFactor = "Custom"
  170. MainP.Size = Vector3.new(With,Highth,With)
  171. MainP.BrickColor = BrickColor.new(Colors[OnColor])
  172. MainP.Anchored = true
  173. MainP:BreakJoints()
  174. Instance.new("CylinderMesh",MainP)
  175.  
  176. game:GetService("RunService").Stepped:connect(function()
  177. if Mode == 1 then
  178. if Mode2 == 1 then
  179. Torso.CFrame = Torso.CFrame*CFrame.new(0,-.5,0)
  180. elseif Mode2 == 2 then
  181. Torso.CFrame = Torso.CFrame*CFrame.new(0,.5,0)
  182. end
  183. MainP.CFrame = Torso.CFrame * CFrame.new(0,-3+-.225,0)
  184. elseif Mode == 2 then
  185. MainP.CFrame = Torso.CFrame * CFrame.new(5,5,5)
  186. else
  187. Mode = 1
  188. MainP.CFrame = Torso.CFrame * CFrame.new(0,-3+-.225,0)
  189. end
  190. end)
  191.  
  192. LastPart = MainP
  193. Num = 4
  194. game:GetService("RunService").Stepped:connect(function()
  195. local a = OnColor+1
  196. if #Colors < a then
  197. OnColor = 1
  198. else
  199. OnColor = OnColor+1
  200. end
  201. a = MainP:Clone()
  202. a.Mesh.Scale = Vector3.new(.8,.8,.8)
  203. a.Parent = MainP.Parent
  204. a.BrickColor = BrickColor.new(Colors[OnColor])
  205. a.CanCollide = false
  206. aPOS = a.CFrame
  207. coroutine.wrap(function()
  208. for i = 0,1,1/15 do wait()
  209. a.Transparency = i
  210. end
  211. a:Destroy()
  212. end)()
  213. coroutine.wrap(function()
  214. for i = .8,0,.8/-15 do wait()
  215. a.Mesh.Scale = Vector3.new(i,i-.05,i)
  216. end
  217. end)()
  218. end)
  219. local BHold = false
  220. Mouse.KeyDown:connect(function(Key)
  221. if Key == "c" and Mode == 1 then
  222. BHold = true
  223. repeat wait() Mode2 = 1 until BHold == false
  224. Mode2 = 0
  225. elseif Key == "z" and Mode == 1 then
  226. BHold = true
  227. repeat wait() Mode2 = 2 until BHold == false
  228. Mode2 = 0
  229. elseif Key == "p" then
  230. if Mode == 1 then
  231. Mode = 2
  232. coroutine.wrap(function()
  233. while Mode == 2 do
  234. wait()
  235. if Char:GetModelCFrame().p.y < -10 then
  236. Mode = 1
  237. end
  238. end
  239. end)()
  240. else
  241. Mode = 1
  242. end
  243. end
  244. end)
  245. Mouse.KeyUp:connect(function(Key)
  246. if Key == "c" or Key == "z" then
  247. BHold = false
  248. end
  249. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement