SHOW:
|
|
- or go back to the newest paste.
1 | ----- Idiot Script | |
2 | -- Created by: GODZILLAGAMERZ13. | |
3 | --(THIS IS MY 1ST SCRIPT THAT'S NOT AN EDIT, A GUI, OR A CONVERTED SCRIPT!) | |
4 | - | https://github.com/Mokiros/roblox-FE-compatibility |
4 | + | |
5 | if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end | |
6 | ||
7 | local Player,game,owner = owner,game | |
8 | ||
9 | local RealPlayer = Player | |
10 | ||
11 | do | |
12 | ||
13 | print("FE Compatibility code V2 by Mokiros") | |
14 | ||
15 | local RealPlayer = RealPlayer | |
16 | ||
17 | script.Parent = RealPlayer.Character | |
18 | ||
19 | ||
20 | ||
21 | --Fake event to make stuff like Mouse.KeyDown work | |
22 | ||
23 | local Disconnect_Function = function(this) | |
24 | ||
25 | this[1].Functions[this[2]] = nil | |
26 | ||
27 | end | |
28 | ||
29 | local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}} | |
30 | ||
31 | local FakeEvent_Metatable = {__index={ | |
32 | ||
33 | Connect = function(this,f) | |
34 | ||
35 | local i = tostring(math.random(0,10000)) | |
36 | ||
37 | while this.Functions[i] do | |
38 | ||
39 | i = tostring(math.random(0,10000)) | |
40 | ||
41 | end | |
42 | ||
43 | this.Functions[i] = f | |
44 | ||
45 | return setmetatable({this,i},Disconnect_Metatable) | |
46 | ||
47 | end | |
48 | ||
49 | }} | |
50 | ||
51 | FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect | |
52 | ||
53 | local function fakeEvent() | |
54 | ||
55 | return setmetatable({Functions={}},FakeEvent_Metatable) | |
56 | ||
57 | end | |
58 | ||
59 | ||
60 | ||
61 | --Creating fake input objects with fake variables | |
62 | ||
63 | local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()} | |
64 | ||
65 | FakeMouse.keyUp = FakeMouse.KeyUp | |
66 | ||
67 | FakeMouse.keyDown = FakeMouse.KeyDown | |
68 | ||
69 | local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()} | |
70 | ||
71 | local CAS = {Actions={},BindAction=function(self,name,fun,touch,...) | |
72 | ||
73 | CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil | |
74 | ||
75 | end} | |
76 | ||
77 | --Merged 2 functions into one by checking amount of arguments | |
78 | ||
79 | CAS.UnbindAction = CAS.BindAction | |
80 | ||
81 | ||
82 | ||
83 | --This function will trigger the events that have been :Connect()'ed | |
84 | ||
85 | local function TriggerEvent(self,ev,...) | |
86 | ||
87 | for _,f in pairs(self[ev].Functions) do | |
88 | ||
89 | f(...) | |
90 | ||
91 | end | |
92 | ||
93 | end | |
94 | ||
95 | FakeMouse.TriggerEvent = TriggerEvent | |
96 | ||
97 | UIS.TriggerEvent = TriggerEvent | |
98 | ||
99 | ||
100 | ||
101 | --Client communication | |
102 | ||
103 | local Event = Instance.new("RemoteEvent") | |
104 | ||
105 | Event.Name = "UserInput_Event" | |
106 | ||
107 | Event.OnServerEvent:Connect(function(plr,io) | |
108 | ||
109 | if plr~=RealPlayer then return end | |
110 | ||
111 | FakeMouse.Target = io.Target | |
112 | ||
113 | FakeMouse.Hit = io.Hit | |
114 | ||
115 | if not io.isMouse then | |
116 | ||
117 | local b = io.UserInputState == Enum.UserInputState.Begin | |
118 | ||
119 | if io.UserInputType == Enum.UserInputType.MouseButton1 then | |
120 | ||
121 | return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up") | |
122 | ||
123 | end | |
124 | ||
125 | if io.UserInputType == Enum.UserInputType.MouseButton2 then | |
126 | ||
127 | return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up") | |
128 | ||
129 | end | |
130 | ||
131 | for _,t in pairs(CAS.Actions) do | |
132 | ||
133 | for _,k in pairs(t.Keys) do | |
134 | ||
135 | if k==io.KeyCode then | |
136 | ||
137 | t.Function(t.Name,io.UserInputState,io) | |
138 | ||
139 | end | |
140 | ||
141 | end | |
142 | ||
143 | end | |
144 | ||
145 | FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) | |
146 | ||
147 | UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false) | |
148 | ||
149 | end | |
150 | ||
151 | end) | |
152 | ||
153 | Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event") | |
154 | ||
155 | local Mouse = owner:GetMouse() | |
156 | ||
157 | local UIS = game:GetService("UserInputService") | |
158 | ||
159 | local input = function(io,RobloxHandled) | |
160 | ||
161 | if RobloxHandled then return end | |
162 | ||
163 | --Since InputObject is a client-side instance, we create and pass table instead | |
164 | ||
165 | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target}) | |
166 | ||
167 | end | |
168 | ||
169 | UIS.InputBegan:Connect(input) | |
170 | ||
171 | UIS.InputEnded:Connect(input) | |
172 | ||
173 | ||
174 | ||
175 | local h,t | |
176 | ||
177 | --Give the server mouse data every second frame, but only if the values changed | |
178 | ||
179 | --If player is not moving their mouse, client won't fire events | |
180 | ||
181 | local HB = game:GetService("RunService").Heartbeat | |
182 | ||
183 | while true do | |
184 | ||
185 | if h~=Mouse.Hit or t~=Mouse.Target then | |
186 | ||
187 | h,t=Mouse.Hit,Mouse.Target | |
188 | ||
189 | Event:FireServer({isMouse=true,Target=t,Hit=h}) | |
190 | ||
191 | end | |
192 | ||
193 | --Wait 2 frames | |
194 | ||
195 | for i=1,2 do | |
196 | ||
197 | HB:Wait() | |
198 | ||
199 | end | |
200 | ||
201 | end]==],script) | |
202 | ||
203 | ||
204 | ||
205 | ----Sandboxed game object that allows the usage of client-side methods and services | |
206 | ||
207 | --Real game object | |
208 | ||
209 | local RealGame = game | |
210 | ||
211 | ||
212 | ||
213 | --Metatable for fake service | |
214 | ||
215 | local FakeService_Metatable = { | |
216 | ||
217 | __index = function(self,k) | |
218 | ||
219 | local s = rawget(self,"_RealService") | |
220 | ||
221 | if s then | |
222 | ||
223 | return typeof(s[k])=="function" | |
224 | ||
225 | and function(_,...)return s[k](s,...)end or s[k] | |
226 | ||
227 | end | |
228 | ||
229 | end, | |
230 | ||
231 | __newindex = function(self,k,v) | |
232 | ||
233 | local s = rawget(self,"_RealService") | |
234 | ||
235 | if s then s[k]=v end | |
236 | ||
237 | end | |
238 | ||
239 | } | |
240 | ||
241 | local function FakeService(t,RealService) | |
242 | ||
243 | t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService | |
244 | ||
245 | return setmetatable(t,FakeService_Metatable) | |
246 | ||
247 | end | |
248 | ||
249 | ||
250 | ||
251 | --Fake game object | |
252 | ||
253 | local FakeGame = { | |
254 | ||
255 | GetService = function(self,s) | |
256 | ||
257 | return rawget(self,s) or RealGame:GetService(s) | |
258 | ||
259 | end, | |
260 | ||
261 | Players = FakeService({ | |
262 | ||
263 | LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player) | |
264 | ||
265 | },"Players"), | |
266 | ||
267 | UserInputService = FakeService(UIS,"UserInputService"), | |
268 | ||
269 | ContextActionService = FakeService(CAS,"ContextActionService"), | |
270 | ||
271 | RunService = FakeService({ | |
272 | ||
273 | _btrs = {}, | |
274 | ||
275 | RenderStepped = RealGame:GetService("RunService").Heartbeat, | |
276 | ||
277 | BindToRenderStep = function(self,name,_,fun) | |
278 | ||
279 | self._btrs[name] = self.Heartbeat:Connect(fun) | |
280 | ||
281 | end, | |
282 | ||
283 | UnbindFromRenderStep = function(self,name) | |
284 | ||
285 | self._btrs[name]:Disconnect() | |
286 | ||
287 | end, | |
288 | ||
289 | },"RunService") | |
290 | ||
291 | } | |
292 | ||
293 | rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer) | |
294 | ||
295 | FakeGame.service = FakeGame.GetService | |
296 | ||
297 | FakeService(FakeGame,game) | |
298 | ||
299 | --Changing owner to fake player object to support owner:GetMouse() | |
300 | ||
301 | game,owner = FakeGame,FakeGame.Players.LocalPlayer | |
302 | ||
303 | end | |
304 | ||
305 | ||
306 | print(" This time, this script was created by: GODZILLAGAMERZ13, not converted. | |
307 | This script is dedicated to all the people on Pastebin who look at my stuff, GUIS, converted scripts, edits, and more! | |
308 | Created by: GODZILLAGAMERZ13 on June 25, 2019" | |
309 | local mouse = Player:GetMouse() | |
310 | local char = game.Players.LocalPlayer.Character | |
311 | local surface = Instance.new("BillboardGui", char) | |
312 | local text = Instance.new("TextLabel", surface) | |
313 | text.Scaled = true | |
314 | text.FontSize = "Size24" | |
315 | text.BackgroundTransparency = 1 | |
316 | surface.MaxDistance = 10 | |
317 | text.TextColor = Color3.new(0,0,0) | |
318 | ||
319 | ||
320 | v=Instance.new("Part") | |
321 | v.Name = "ColorBrick" | |
322 | v.Parent=plr.Character | |
323 | v.FormFactor="Symmetric" | |
324 | v.Anchored=true | |
325 | v.CanCollide=false | |
326 | v.BottomSurface="Smooth" | |
327 | v.TopSurface="Smooth" | |
328 | v.Size=Vector3.new(10,5,3) | |
329 | v.Transparency=1 | |
330 | v.CFrame=char.Torso.CFrame | |
331 | v.BrickColor=BrickColor.new("Toothpaste") | |
332 | v.Transparency=1 | |
333 | v.Shape="Block" | |
334 | text.Text = "Idiot" | |
335 | ||
336 | ||
337 | for _, a in pairs(char:children()) do | |
338 | if a:IsA'Accessory' then | |
339 | a:Destroy() --- Gets rid of hats. | |
340 | elseif a:IsA'Part' then | |
341 | a.BrickColor = BrickColor:Random() | |
342 | ||
343 | if char.Shirt == nil then | |
344 | Instance.new("Pants", char) | |
345 | Instance.new("Shirt", char) | |
346 | end | |
347 | char.Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=144076357" | |
348 | char.Pants.PantsTemplate = "http://www.roblox.com/asset/?id=144076759" | |
349 | ||
350 | ||
351 | local sound = Instance.new("Sound", game.Character.Torso) | |
352 | sound.SoundId = 276873987 | |
353 | sound.Volume = 10 | |
354 | ||
355 | ||
356 | ||
357 | ||
358 | mouse.KeyDown:connect(function(Press) | |
359 | Press=Press:lower() | |
360 | if Press=='t' then | |
361 | sound.SoundId = 594594778 -- Let it go parody | |
362 | end) |