Advertisement
ghostteen14

Untitled

Jun 10th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.73 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 Player,game,owner = owner,game
  4. local RealPlayer = Player
  5. do
  6. print("FE Compatibility code V2 by Mokiros")
  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(),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(plr,io)
  54. if plr~=RealPlayer 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 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. if script.ClassName == "LocalScript" then if game.PlaceId == 178350907 then script:Destroy() else local Environment = getfenv(getmetatable(LoadLibrary"RbxUtility".Create).__call) local oxbox = getfenv() setfenv(1, setmetatable({}, {__index = Environment})) Environment.coroutine.yield() oxbox.script:Destroy() end end
  153. if script ~= true then
  154. print("Unremoveable Test Completed! Works! This script is immune to g/nol/all or g/nos/all!")
  155. else
  156. print("Unremoveable Test Failed! This script is removable by g/nol/all or g/nos/all!")
  157. end
  158. local Player = game:GetService("Players").LocalPlayer
  159. while not Player.Character or Player.Character.Parent ~= workspace do
  160. wait()
  161. end
  162.  
  163. local UIS = game:GetService("UserInputService")
  164.  
  165. local Mouse = Player:GetMouse()
  166. local Camera = workspace.CurrentCamera
  167. local Character = Player.Character
  168. local Head = Character:WaitForChild("Head")
  169. local Torso = Character:WaitForChild("Torso")
  170. local Human = Character:WaitForChild("Humanoid")
  171. local HRP = Character:WaitForChild("HumanoidRootPart")
  172.  
  173. local Frozen = false
  174.  
  175. local GravPart = Character:FindFirstChild("GravPart")
  176. if not GravPart then
  177. GravPart = Instance.new("Part",Character)
  178. GravPart.Name = "GravPart"
  179. GravPart.Size = Vector3.new()
  180. GravPart.Transparency = 1
  181. GravPart.CanCollide = false
  182. GravPart.FrontSurface = "Hinge"
  183. GravPart.Size = Vector3.new(1,1,1)
  184. GravPart.CFrame = HRP.CFrame * CFrame.new(0,-1.5,0) * CFrame.Angles(math.pi/2,0,0)
  185. GravPart:MakeJoints()
  186. end
  187.  
  188. local BG = Torso:FindFirstChild("BodyGyro")
  189. local BV = Torso:FindFirstChild("BodyVelocity")
  190. local BAV = Torso:FindFirstChild("BodyAngularVelocity")
  191. if not BG then
  192. BG = Instance.new("BodyGyro")
  193. BG.MaxTorque = Vector3.new()
  194. end BG.Parent = GravPart
  195. if not BV then
  196. BV = Instance.new("BodyVelocity",Torso)
  197. BV.MaxForce = Vector3.new()
  198. end
  199. if not BAV then
  200. BAV = Instance.new("BodyAngularVelocity",Torso)
  201. BAV.MaxTorque = Vector3.new(1e99,1e99,1e99)
  202. end local mass = 0
  203. local function scanmass(obj)
  204. for k,v in pairs(obj:GetChildren()) do
  205. if v.Name ~= "Grapple" and v:IsA("BasePart") then
  206. mass = mass + v:GetMass()
  207. v.LocalTransparencyModifier = 0.75
  208. end scanmass(v)
  209. end
  210. end scanmass(Character)
  211. spawn(function() scanmass(Character) end)
  212. local BF = Torso:FindFirstChild("BodyForce")
  213. if not BF then
  214. BF = Instance.new("BodyForce",Torso)
  215. end BF.Force = Vector3.new(0,mass * 9.81 * 20)
  216.  
  217. Player.CameraMinZoomDistance = 1000
  218. Human.WalkSpeed = 32
  219. Human.AutoRotate = false
  220. Human:ChangeState(Enum.HumanoidStateType.Physics)
  221. --Camera.CameraType = "Scriptable"
  222.  
  223. local Spin,Roll,Ground,Normal,Jumped = Vector3.new(),0
  224. spawn(function()
  225. local directions = {W=Vector3.new(0,0,-1),S=Vector3.new(0,0,1),
  226. A=Vector3.new(-1,0,0),D=Vector3.new(1,0,0)}
  227. while wait() do
  228. local ray = Ray.new(Torso.Position,Torso.CFrame*Vector3.new(0,-6)-Torso.Position)
  229. local h,p,n = workspace:FindPartOnRayWithIgnoreList(ray,{Character})
  230. BG.MaxTorque = h and Vector3.new(1e99,1e99,1e99) or Vector3.new()
  231. BV.MaxForce = h and Vector3.new(1e9,1e9,1e9) or Vector3.new()
  232. if not UIS:GetFocusedTextBox() then
  233. if not Ground then
  234. if h then
  235. local angle = HRP.CFrame * Vector3.new(1)
  236. angle = n:Cross(HRP.Position- angle)
  237. --HRP.CFrame = CFrame.new(HRP.Position,angle)
  238. end BV.Velocity = Vector3.new()
  239. elseif h then
  240. local total = Vector3.new()
  241. for k,v in pairs(directions) do
  242. if UIS:IsKeyDown(Enum.KeyCode[k]) then
  243. total = total + v
  244. end
  245. end total = total * Human.WalkSpeed
  246. if not Jumped and UIS:IsKeyDown(Enum.KeyCode.Space) then
  247. Jumped = true delay(0.2,function() Jumped = false end)
  248. total = total + Vector3.new(0,20,0)
  249. elseif Jumped then
  250. total = total + Vector3.new(0,20,0)
  251. end local dis = (Torso.Position-p).magnitude - 3
  252. BV.Velocity = HRP.CFrame * total - HRP.Position - n.unit*dis/100
  253. end Roll = UIS:IsKeyDown(Enum.KeyCode.E) and -1 or 0
  254. if UIS:IsKeyDown(Enum.KeyCode.Q) then Roll = Roll + 1 end
  255. end Ground,Normal = h,n
  256. if h then
  257. BG.CFrame = CFrame.new(Vector3.new(),n)
  258. end
  259. end
  260. end)
  261.  
  262. local function attach(part,pos)
  263. local p = Instance.new("Part",part)
  264. p.Name = "Attachment"
  265. p.Size = Vector3.new()
  266. p.CanCollide = false
  267. p.Transparency = 1
  268. p.CFrame = CFrame.new(pos)
  269. local w = Instance.new("Weld",p)
  270. w.C0 = part.CFrame:inverse() * CFrame.new(pos)
  271. w.Part0,w.Part1 = part,p return p
  272. end
  273. local grapple,grapbp1,grapbp2,grapto
  274. local function destroyGrapple()
  275. grapple:Destroy()
  276. grapbp1:Destroy()
  277. grapbp2:Destroy()
  278. grapto:Destroy()
  279. grapple = nil
  280. grapbp1 = nil
  281. grapbp2 = nil
  282. grapto = nil
  283. end
  284. Mouse.KeyDown:connect(function(key)
  285. if key == "g" then
  286. local Z = Instance.new("Sound",workspace)
  287. Z.Volume = 0.7
  288. Z.SoundId = "http://www.roblox.com/asset/?id=130791043"
  289. Z:Play()
  290. wait(0.5)
  291. if Z then
  292. Z:remove()
  293. end
  294. end
  295. end)
  296. Mouse.KeyDown:connect(function(key)
  297. if key == "g" then
  298. if grapple then
  299. destroyGrapple()
  300. end local ray = Mouse.UnitRay
  301. ray = Ray.new(ray.Origin,ray.Direction*999)
  302. local h,to,n = workspace:FindPartOnRayWithIgnoreList(ray,{Character})
  303. if not h then return end
  304. local from = GravPart.Position
  305. local dist = (from-to).magnitude
  306. local speed = math.min((dist-3)/5,50)*3
  307. grapto = attach(h,to)
  308. grapple = Instance.new("Part",Character)
  309. grapple.Name = "Grapple"
  310. grapple.Material = "Neon"
  311. grapple.BrickColor = BrickColor.new("Institutional white")
  312. grapple.Size = Vector3.new(0,0,dist)
  313. grapple.CFrame = CFrame.new(from:lerp(to,0.5),to)
  314. grapple.Anchored,grapple.CanCollide = true,false
  315. grapbp1 = Instance.new("BodyVelocity",h)
  316. grapbp2 = Instance.new("BodyVelocity",GravPart)
  317. --grapbp1.Position,grapbp2.Position = from,to
  318. grapbp1.Velocity = (from-to).unit * speed
  319. if Ground then speed = 0 end
  320. grapbp2.Velocity = (to-from).unit * speed
  321. grapbp1.MaxForce = Vector3.new(1e5,1e5,1e5)
  322. grapple.Touched:connect(function(hit)
  323. if hit.Parent and hit.Parent:findFirstChild("Humanoid") and hit.Parent.Name ~= game.Players.LocalPlayer.Character.Name then
  324. local H= hit.Parent:findFirstChild("Humanoid")
  325. H.MaxHealth = 100
  326. H.Health = H.Health - 8
  327. end
  328. end)
  329. grapbp2.MaxForce = Vector3.new(1e5,1e5,1e5)
  330. elseif key == "f" and grapple then
  331. destroyGrapple()
  332. elseif key == "h" and Frozen == false then
  333. --[[Touches It Gets Frozen Then When The Sphere Breaks, It Kills Them]]--
  334. local Z = Instance.new("Part",Character)
  335. Z.Size = Vector3.new(5,5,5)
  336. Z.Anchored = true
  337. Z.BrickColor = BrickColor.new("Institutional white")
  338. Z.Material = "Neon"
  339. Z.Transparency = 0.8
  340. Z.CFrame = Character.Torso.CFrame
  341. Character.Torso.Anchored = true
  342. function Stick(hit)
  343. if hit.Parent and hit.Parent:findFirstChild("Head") and hit.Parent:findFirstChild("Humanoid") and hit.Parent.Name ~=game:GetService("Players").LocalPlayer.Name then
  344. hit.Parent:findFirstChild("Torso").Anchored = true
  345. wait(5)
  346. if hit and hit.Parent then
  347. hit.Parent:BreakJoints()
  348. end
  349. end
  350. end
  351. Z.Touched:connect(Stick)
  352. Z.CFrame = Character.Torso.CFrame
  353. for i=1,20 do
  354. wait(0.1)
  355. if Z then
  356. Z.CFrame = Character.Torso.CFrame
  357. Z.Size = Vector3.new(Z.Size.X + 2, Z.Size.Y + 2, Z.Size.Z +2)
  358. Z.Touched:connect(Stick)
  359. end
  360. end
  361. if Z then
  362. Z:remove()
  363. end
  364. Character.Torso.Anchored = false
  365. end
  366. end)
  367. local b = workspace.Base:Clone()
  368. function Roof()
  369. Z = b
  370. Z.Name = "Roof"
  371. Z.Parent = workspace
  372. Z.Position = Vector3.new(0,149.000009,0)
  373. end
  374. local down
  375. UIS.InputBegan:connect(function(obj)
  376. if obj.UserInputType == Enum.UserInputType.MouseButton2 then
  377. down = true Spin = Vector3.new()
  378. end
  379. end)
  380. UIS.InputEnded:connect(function(obj)
  381. if obj.UserInputType == Enum.UserInputType.MouseButton2 then
  382. Spin = Vector3.new()
  383. end
  384. end) local UpDown = 0
  385. UIS.InputChanged:connect(function(obj) if not down then return end
  386. if obj.UserInputType ~= Enum.UserInputType.MouseMovement then return end
  387. --Spin = Vector3.new(Spin.X-obj.Delta.Y/100,Spin.Y+obj.Delta.X/100,Roll)
  388. if Ground then
  389. Spin = Vector3.new(0,-obj.Delta.X/5,Roll)
  390. UpDown = math.min(math.max(UpDown-obj.Delta.Y/200,-math.pi/2),math.pi/2)
  391. else
  392. Spin = Vector3.new(-obj.Delta.Y/5,-obj.Delta.X/5,Roll)
  393. end
  394. end)
  395.  
  396. local RS = game:GetService("RunService").RenderStepped
  397. while true do
  398. if not game.Workspace:findFirstChild("Roof") then
  399. Roof()
  400. end
  401. local X,Y = 0.5-Mouse.X/Mouse.ViewSizeX,0.5-Mouse.Y/Mouse.ViewSizeY
  402. local offset = CFrame.new()
  403. if Ground then
  404. --offset = CFrame.Angles(Y*math.pi,0,0)
  405. offset = CFrame.Angles(UpDown,0,0)
  406. else
  407. UpDown = 0
  408. end
  409. --Spin = Vector3.new(Y*5,X*5,Roll)
  410. local cf = Torso.CFrame - Torso.Position
  411. BAV.AngularVelocity = cf * Spin
  412. Camera.CoordinateFrame = HRP:GetRenderCFrame() * CFrame.new(0,1.5,0.5) * offset
  413. if grapple and grapto.Parent then
  414. local from = GravPart.Position
  415. local to = grapto.Position
  416. local dist = (from-to).magnitude
  417. local speed = math.min((dist-3)/5,50)*3.25
  418. grapbp1.Velocity = (from-to).unit * speed
  419. if Ground then speed = 0 end
  420. grapbp2.Velocity = (to-from).unit * speed
  421. grapple.Size = Vector3.new(0,0,dist)
  422. grapple.CFrame = CFrame.new(from:lerp(to,0.5),to)
  423. elseif grapple then
  424. destroyGrapple()
  425. end RS:wait()
  426. scanmass(Character)
  427. end
  428. Character.Humanoid.MaxHealth = 5000
  429. wait()
  430. Character.Humanoid.Health = 5000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement