Advertisement
Mediakiller7Cool

Tsunami

Mar 17th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.19 KB | None | 0 0
  1. Player,game,owner = owner,game
  2. local RealPlayer = Player
  3. do
  4. print("FE Compatibility code V2 by Mokiros")
  5. local RealPlayer = RealPlayer
  6. script.Parent = RealPlayer.Character
  7.  
  8. --Fake event to make stuff like Mouse.KeyDown work
  9. local Disconnect_Function = function(this)
  10. this[1].Functions[this[2]] = nil
  11. end
  12. local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
  13. local FakeEvent_Metatable = {__index={
  14. Connect = function(this,f)
  15. local i = tostring(math.random(0,10000))
  16. while this.Functions[i] do
  17. i = tostring(math.random(0,10000))
  18. end
  19. this.Functions[i] = f
  20. return setmetatable({this,i},Disconnect_Metatable)
  21. end
  22. }}
  23. FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
  24. local function fakeEvent()
  25. return setmetatable({Functions={}},FakeEvent_Metatable)
  26. end
  27.  
  28. --Creating fake input objects with fake variables
  29. local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  30. FakeMouse.keyUp = FakeMouse.KeyUp
  31. FakeMouse.keyDown = FakeMouse.KeyDown
  32. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  33. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  34. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  35. end}
  36. --Merged 2 functions into one by checking amount of arguments
  37. CAS.UnbindAction = CAS.BindAction
  38.  
  39. --This function will trigger the events that have been :Connect()'ed
  40. local function TriggerEvent(self,ev,...)
  41. for _,f in pairs(self[ev].Functions) do
  42. f(...)
  43. end
  44. end
  45. FakeMouse.TriggerEvent = TriggerEvent
  46. UIS.TriggerEvent = TriggerEvent
  47.  
  48. --Client communication
  49. local Event = Instance.new("RemoteEvent")
  50. Event.Name = "UserInput_Event"
  51. Event.OnServerEvent:Connect(function(plr,io)
  52. if plr~=RealPlayer then return end
  53. FakeMouse.Target = io.Target
  54. FakeMouse.Hit = io.Hit
  55. if not io.isMouse then
  56. local b = io.UserInputState == Enum.UserInputState.Begin
  57. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  58. return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
  59. end
  60. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  61. return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
  62. end
  63. for _,t in pairs(CAS.Actions) do
  64. for _,k in pairs(t.Keys) do
  65. if k==io.KeyCode then
  66. t.Function(t.Name,io.UserInputState,io)
  67. end
  68. end
  69. end
  70. FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  71. UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
  72. end
  73. end)
  74. Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
  75. local Mouse = owner:GetMouse()
  76. local UIS = game:GetService("UserInputService")
  77. local input = function(io,RobloxHandled)
  78. if RobloxHandled then return end
  79. --Since InputObject is a client-side instance, we create and pass table instead
  80. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  81. end
  82. UIS.InputBegan:Connect(input)
  83. UIS.InputEnded:Connect(input)
  84. local h,t
  85. --Give the server mouse data every second frame, but only if the values changed
  86. --If player is not moving their mouse, client won't fire events
  87. local HB = game:GetService("RunService").Heartbeat
  88. while true do
  89. if h~=Mouse.Hit or t~=Mouse.Target then
  90. h,t=Mouse.Hit,Mouse.Target
  91. Event:FireServer({isMouse=true,Target=t,Hit=h})
  92. end
  93. --Wait 2 frames
  94. for i=1,2 do
  95. HB:Wait()
  96. end
  97. end]==],script)
  98.  
  99. ----Sandboxed game object that allows the usage of client-side methods and services
  100. --Real game object
  101. local RealGame = game
  102.  
  103. --Metatable for fake service
  104. local FakeService_Metatable = {
  105. __index = function(self,k)
  106. local s = rawget(self,"_RealService")
  107. if s then
  108. return typeof(s[k])=="function"
  109. and function(_,...)return s[k](s,...)end or s[k]
  110. end
  111. end,
  112. __newindex = function(self,k,v)
  113. local s = rawget(self,"_RealService")
  114. if s then s[k]=v end
  115. end
  116. }
  117. local function FakeService(t,RealService)
  118. t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
  119. return setmetatable(t,FakeService_Metatable)
  120. end
  121.  
  122. --Fake game object
  123. local FakeGame = {
  124. GetService = function(self,s)
  125. return rawget(self,s) or RealGame:GetService(s)
  126. end,
  127. Players = FakeService({
  128. LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
  129. },"Players"),
  130. UserInputService = FakeService(UIS,"UserInputService"),
  131. ContextActionService = FakeService(CAS,"ContextActionService"),
  132. RunService = FakeService({
  133. _btrs = {},
  134. RenderStepped = RealGame:GetService("RunService").Heartbeat,
  135. BindToRenderStep = function(self,name,_,fun)
  136. self._btrs[name] = self.Heartbeat:Connect(fun)
  137. end,
  138. UnbindFromRenderStep = function(self,name)
  139. self._btrs[name]:Disconnect()
  140. end,
  141. },"RunService")
  142. }
  143. rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
  144. FakeGame.service = FakeGame.GetService
  145. FakeService(FakeGame,game)
  146. --Changing owner to fake player object to support owner:GetMouse()
  147. game,owner = FakeGame,FakeGame.Players.LocalPlayer
  148. end
  149. o1 = Instance.new("Part")
  150. o1.Name = "WAVE"
  151. o1.Parent = workspace
  152. o1.Material = Enum.Material.Granite
  153. o1.BrickColor = BrickColor.new("Electric blue")
  154. o1.Transparency = 0.30000001192093
  155. o1.Position = Vector3.new(-277.570068, 15.4718628, -1565.60864)
  156. o1.Anchored = true
  157. o1.CanCollide = false
  158. o1.Size = Vector3.new(2048, 155.029999, 1968.98999)
  159. o1.CFrame = CFrame.new(-277.570068, 15.4718628, -1565.60864, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  160. o1.BackSurface = Enum.SurfaceType.SmoothNoOutlines
  161. o1.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
  162. o1.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
  163. o1.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
  164. o1.RightSurface = Enum.SurfaceType.SmoothNoOutlines
  165. o1.TopSurface = Enum.SurfaceType.SmoothNoOutlines
  166. o1.Color = Color3.new(0.0352941, 0.537255, 0.811765)
  167.  
  168. function FLOAT (part)
  169. for i,v in pairs(part:GetChildren()) do
  170. if v:IsA("BodyPosition") then
  171. v:Destroy()
  172. end
  173. end
  174. local m = Instance.new("BodyPosition")
  175.  
  176. m.Parent = part
  177.  
  178. m.maxForce = Vector3.new(4e+006,4e+006,4e+006)
  179.  
  180. m.position = Vector3.new(part.Position.X,workspace.WAVE.Position.Y,part.Position.Z)
  181. end
  182. function DestroyHorrible (part)
  183. if part.Name ~= "Baseplate" then
  184. if part.Transparency < .5 then
  185. FLOAT(part)
  186. part.Anchored = false part.Size = part.Size/1.5
  187. for i=1,4 do
  188. part:Clone()
  189. end
  190. local o1g = Instance.new("Sound")
  191. o1g.Parent = part
  192. o1g.SoundId = "rbxassetid://516789356"
  193. o1g:Play()
  194. elseif part.Material == "Wood" or part.Material == "WoodPlanks" then
  195. part.Anchored = false part.Size = part.Size/1.5
  196. FLOAT(part)
  197. for i=1,4 do
  198. part:Clone()
  199. end
  200. local o1j = Instance.new("Sound")
  201. o1j.Parent = part
  202. o1j.Volume = 2
  203. o1j.SoundId = "rbxassetid://516777998"
  204. o1j:Play()
  205. else
  206. FLOAT(part)
  207. part.Anchored = false part.Size = part.Size/1.5
  208. for i=1,4 do
  209. part:Clone()
  210. end
  211. local go1 = Instance.new("Sound")
  212. go1.Parent = part
  213. go1.Volume = 1
  214. go1.SoundId = "rbxassetid://516777998"
  215. go1:Play()
  216. end
  217. end
  218. end
  219. myears = Instance.new('Sound')
  220. myears.Parent = workspace
  221. myears.Looped = false
  222. myears.Name = "Ruski"
  223. myears.Playing = true
  224. myears.SoundId = "rbxassetid://557673018"
  225. myears.Volume = .5
  226. myears.TimePosition = 0
  227. myears:Play()
  228. workspace.WAVE.Touched:Connect(DestroyHorrible)
  229. workspace.WAVE.CFrame = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame + Vector3.new(-2200,0,0)
  230. o1 = Instance.new("Sound")
  231. o1.Parent = workspace
  232. o1.SoundId = "rbxassetid://135560679"
  233. o1.Volume = 1
  234. o1:Play()
  235. h = 0
  236. j = 1
  237. for i=1,2000 do
  238. j = j+1
  239. wait()
  240. workspace.WAVE.CFrame = workspace.WAVE.CFrame + Vector3.new(4,0,0)
  241. if j == 400 then
  242. game.workspace.Terrain:FillBlock(workspace.WAVE.CFrame,workspace.WAVE.Size,Enum.Material.Water)
  243. a = function(instance)
  244. for i,v in pairs(instance:GetChildren()) do
  245. if v.className == "Part" and v.Name ~="Baseplate" then
  246. v.Anchored = false
  247. end
  248. a(v)
  249. end
  250. end
  251. a(workspace)
  252. end
  253. end
  254. workspace.WAVE:Destroy()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement