Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2020
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.99 KB | None | 0 0
  1.  
  2. --https://github.com/Mokiros/roblox-FE-compatibility
  3. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  4. local Player,game,owner = owner,game
  5. local RealPlayer = Player
  6. do
  7. print("FE Compatibility code V2 by Mokiros")
  8. local RealPlayer = RealPlayer
  9. script.Parent = RealPlayer.Character
  10.  
  11. --Fake event to make stuff like Mouse.KeyDown work
  12. local Disconnect_Function = function(this)
  13. this[1].Functions[this[2]] = nil
  14. end
  15. local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
  16. local FakeEvent_Metatable = {__index={
  17. Connect = function(this,f)
  18. local i = tostring(math.random(0,10000))
  19. while this.Functions[i] do
  20. i = tostring(math.random(0,10000))
  21. end
  22. this.Functions[i] = f
  23. return setmetatable({this,i},Disconnect_Metatable)
  24. end
  25. }}
  26. FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
  27. local function fakeEvent()
  28. return setmetatable({Functions={}},FakeEvent_Metatable)
  29. end
  30.  
  31. --Creating fake input objects with fake variables
  32. local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),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. --This is my first time scripting something! :D
  153. --It's good for horror games too!
  154.  
  155. local mouse = game.Players.LocalPlayer:GetMouse()
  156. function Light()
  157. player = game.Players.LocalPlayer
  158. playerChar = player.Character
  159. playerLight = playerChar.Torso:FindFirstChild("Light")
  160. if playerLight then
  161. playerLight:Destroy()
  162. else
  163. light = Instance.new("PointLight",playerChar:FindFirstChild("Torso"))
  164. light.Name = "Light"
  165. light.Range = 100 -- Change to distance ofthe Light.
  166. light.Brightness = 60 -- Change to how much.
  167. light.Shadows = true -- Change it to True/False.
  168.  
  169.  
  170.  
  171. local play = Instance.new("Sound",playerChar:FindFirstChild("Head"))
  172. play.SoundId = "http://www.roblox.com/asset/?id=1175402304" --Change the "1175402304" to any sound ID you want.
  173. play.Volume = 100
  174. play:Play()
  175.  
  176. local Flanger = Instance.new("FlangeSoundEffect")
  177. Flanger.Rate = 15
  178. Flanger.Parent = play
  179. end
  180. end
  181. mouse.KeyDown:connect(function(key)
  182. key = key:lower()
  183. if key == "f" then -- Change this to any Keys but I reccomand leaving it as [F] key.
  184. Light()
  185.  
  186. Player = "LocalPlayer"
  187. AnimationId = "429703734"
  188. local Anim = Instance.new("Animation")
  189. Anim.AnimationId = "rbxassetid://"..AnimationId
  190. local Anim = game.Players[Player].Character.Humanoid:LoadAnimation(Anim)
  191. Anim:Play()
  192. local Anim = Instance.new("Animation")
  193. Anim.AnimationId = "rbxassetid://429703734"
  194. local Track = owner.Character.Humanoid:LoadAnimation(Anim)
  195. Track:Play(100,100,100)
  196. end
  197.  
  198. BBG = Instance.new("BillboardGui")
  199. BBG.SizeOffset = Vector2.new(0, 3)
  200. BBG.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  201. BBG.ClipsDescendants = true
  202. BBG.Size = UDim2.new(5, 0, 1, 0)
  203. BBG.Active = true
  204. BBG.Parent = owner.Character["Head"]
  205.  
  206. Username = Instance.new("TextBox")
  207. Username.BackgroundTransparency = 1
  208. Username.Font = Enum.Font.Gotham
  209. Username.ShowNativeInput = false
  210. Username.PlaceholderColor3 = Color3.fromRGB(255, 0, 255)
  211. Username.TextStrokeColor3 = Color3.fromRGB(0, 255, 255)
  212. Username.Size = UDim2.new(1, 0, 1, 0)
  213. Username.Position = UDim2.new(0, 0, 1, 0)
  214. Username.TextScaled = true
  215. Username.TextStrokeTransparency = 0.8
  216. Username.Text = "poop"
  217. Username.TextWrapped = true
  218. Username.TextColor3 = Color3.fromRGB(255, 255, 255)
  219. Username.TextSize = 30
  220. Username.Selectable = false
  221. Username.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  222. Username.Parent = BBG
  223.  
  224. Username:TweenPosition(UDim2.new(0, 0, 0, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Sine, 2)
  225. end)
  226.  
  227. -- Made by iKennyHuynh
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement