SHOW:
|
|
- or go back to the newest paste.
1 | -- This script has been converted to FE by iPxter | |
2 | ||
3 | ||
4 | if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end | |
5 | local Player,Mouse,mouse,UserInputService,ContextActionService = owner | |
6 | do | |
7 | print("FE Compatibility code by Mokiros | Translated to FE by iPxter") | |
8 | script.Parent = Player.Character | |
9 | ||
10 | --RemoteEvent for communicating | |
11 | local Event = Instance.new("RemoteEvent") | |
12 | Event.Name = "UserInput_Event" | |
13 | ||
14 | --Fake event to make stuff like Mouse.KeyDown work | |
15 | local function fakeEvent() | |
16 | local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end} | |
17 | t.connect = t.Connect | |
18 | return t | |
19 | end | |
20 | ||
21 | --Creating fake input objects with fake variables | |
22 | local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()} | |
23 | local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()} | |
24 | local CAS = {Actions={},BindAction=function(self,name,fun,touch,...) | |
25 | CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil | |
26 | end} | |
27 | --Merged 2 functions into one by checking amount of arguments | |
28 | CAS.UnbindAction = CAS.BindAction | |
29 | ||
30 | --This function will trigger the events that have been :Connect()'ed | |
31 | local function te(self,ev,...) | |
32 | local t = m[ev] | |
33 | if t and t._fakeEvent and t.Function then | |
34 | t.Function(...) | |
35 | end | |
36 | end | |
37 | m.TrigEvent = te | |
38 | UIS.TrigEvent = te | |
39 | ||
40 | Event.OnServerEvent:Connect(function(plr,io) | |
41 | if plr~=Player then return end | |
42 | if io.isMouse then | |
43 | m.Target = io.Target | |
44 | m.Hit = io.Hit | |
45 | else | |
46 | local b = io.UserInputState == Enum.UserInputState.Begin | |
47 | if io.UserInputType == Enum.UserInputType.MouseButton1 then | |
48 | return m:TrigEvent(b and "Button1Down" or "Button1Up") | |
49 | end | |
50 | for _,t in pairs(CAS.Actions) do | |
51 | for _,k in pairs(t.Keys) do | |
52 | if k==io.KeyCode then | |
53 | t.Function(t.Name,io.UserInputState,io) | |
54 | end | |
55 | end | |
56 | end | |
57 | m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) | |
58 | UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false) | |
59 | end | |
60 | end) | |
61 | Event.Parent = NLS([==[ | |
62 | local Player = game:GetService("Players").LocalPlayer | |
63 | local Event = script:WaitForChild("UserInput_Event") | |
64 | ||
65 | local UIS = game:GetService("UserInputService") | |
66 | local input = function(io,a) | |
67 | if a then return end | |
68 | --Since InputObject is a client-side instance, we create and pass table instead | |
69 | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState}) | |
70 | end | |
71 | UIS.InputBegan:Connect(input) | |
72 | UIS.InputEnded:Connect(input) | |
73 | ||
74 | local Mouse = Player:GetMouse() | |
75 | local h,t | |
76 | --Give the server mouse data 30 times every second, but only if the values changed | |
77 | --If player is not moving their mouse, client won't fire events | |
78 | while wait(1/30) do | |
79 | if h~=Mouse.Hit or t~=Mouse.Target then | |
80 | h,t=Mouse.Hit,Mouse.Target | |
81 | - | workspace.WAVE.CFrame = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame + Vector3.new(-2200,0,0) |
81 | + | Event:FireServer({isMouse=true,Target=t,Hit=h}) |
82 | end | |
83 | end]==],Player.Character) | |
84 | Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS | |
85 | end | |
86 | o1 = Instance.new("Part") | |
87 | o1.Name = "WAVE" | |
88 | o1.Parent = workspace | |
89 | o1.Material = Enum.Material.Granite | |
90 | o1.BrickColor = BrickColor.new("Electric blue") | |
91 | o1.Transparency = 0.30000001192093 | |
92 | o1.Position = Vector3.new(-277.570068, 15.4718628, -1565.60864) | |
93 | o1.Anchored = true | |
94 | o1.CanCollide = false | |
95 | o1.Size = Vector3.new(2048, 155.029999, 1968.98999) | |
96 | o1.CFrame = CFrame.new(-277.570068, 15.4718628, -1565.60864, 1, 0, 0, 0, 1, 0, 0, 0, 1) | |
97 | o1.BackSurface = Enum.SurfaceType.SmoothNoOutlines | |
98 | o1.BottomSurface = Enum.SurfaceType.SmoothNoOutlines | |
99 | o1.FrontSurface = Enum.SurfaceType.SmoothNoOutlines | |
100 | o1.LeftSurface = Enum.SurfaceType.SmoothNoOutlines | |
101 | o1.RightSurface = Enum.SurfaceType.SmoothNoOutlines | |
102 | o1.TopSurface = Enum.SurfaceType.SmoothNoOutlines | |
103 | o1.Color = Color3.new(0.0352941, 0.537255, 0.811765) | |
104 | ||
105 | function FLOAT (part) | |
106 | for i,v in pairs(part:GetChildren()) do | |
107 | if v:IsA("BodyPosition") then | |
108 | v:Destroy() | |
109 | end | |
110 | end | |
111 | local m = Instance.new("BodyPosition") | |
112 | ||
113 | m.Parent = part | |
114 | ||
115 | m.maxForce = Vector3.new(4e+006,4e+006,4e+006) | |
116 | ||
117 | m.position = Vector3.new(part.Position.X,workspace.WAVE.Position.Y,part.Position.Z) | |
118 | end | |
119 | function DestroyHorrible (part) | |
120 | if part.Name ~= "Baseplate" then | |
121 | if part.Transparency < .5 then | |
122 | FLOAT(part) | |
123 | part.Anchored = false part.Size = part.Size/1.5 | |
124 | for i=1,4 do | |
125 | part:Clone() | |
126 | end | |
127 | local o1g = Instance.new("Sound") | |
128 | o1g.Parent = part | |
129 | o1g.SoundId = "rbxassetid://516789356" | |
130 | o1g:Play() | |
131 | elseif part.Material == "Wood" or part.Material == "WoodPlanks" then | |
132 | part.Anchored = false part.Size = part.Size/1.5 | |
133 | FLOAT(part) | |
134 | for i=1,4 do | |
135 | part:Clone() | |
136 | end | |
137 | local o1j = Instance.new("Sound") | |
138 | o1j.Parent = part | |
139 | o1j.Volume = 2 | |
140 | o1j.SoundId = "rbxassetid://516777998" | |
141 | o1j:Play() | |
142 | else | |
143 | FLOAT(part) | |
144 | part.Anchored = false part.Size = part.Size/1.5 | |
145 | for i=1,4 do | |
146 | part:Clone() | |
147 | end | |
148 | local go1 = Instance.new("Sound") | |
149 | go1.Parent = part | |
150 | go1.Volume = 1 | |
151 | go1.SoundId = "rbxassetid://516777998" | |
152 | go1:Play() | |
153 | end | |
154 | end | |
155 | end | |
156 | myears = Instance.new('Sound') | |
157 | myears.Parent = workspace | |
158 | myears.Looped = false | |
159 | myears.Name = "Ruski" | |
160 | myears.Playing = true | |
161 | myears.SoundId = "rbxassetid://557673018" | |
162 | myears.Volume = .5 | |
163 | myears.TimePosition = 0 | |
164 | myears:Play() | |
165 | workspace.WAVE.Touched:Connect(DestroyHorrible) | |
166 | workspace.WAVE.CFrame = owner.Character.HumanoidRootPart.CFrame + Vector3.new(-2200,0,0) | |
167 | o1 = Instance.new("Sound") | |
168 | o1.Parent = workspace | |
169 | o1.SoundId = "rbxassetid://135560679" | |
170 | o1.Volume = 1 | |
171 | o1:Play() | |
172 | h = 0 | |
173 | j = 1 | |
174 | for i=1,2000 do | |
175 | j = j+1 | |
176 | wait() | |
177 | workspace.WAVE.CFrame = workspace.WAVE.CFrame + Vector3.new(4,0,0) | |
178 | if j == 400 then | |
179 | game.workspace.Terrain:FillBlock(workspace.WAVE.CFrame,workspace.WAVE.Size,Enum.Material.Water) | |
180 | a = function(instance) | |
181 | for i,v in pairs(instance:GetChildren()) do | |
182 | if v.className == "Part" and v.Name ~="Baseplate" then | |
183 | v.Anchored = false | |
184 | end | |
185 | a(v) | |
186 | end | |
187 | end | |
188 | a(workspace) | |
189 | end | |
190 | end | |
191 | workspace.WAVE:Destroy() |