SHOW:
|
|
- or go back to the newest paste.
1 | print("FE code by Starzozero, Thanks to him!") | |
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 by Mokiros, Edited by StarzoZero") | |
7 | local rp = RealPlayer | |
8 | script.Parent = rp.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,Functions={},Connect=function(self,f)table.insert(self.Functions,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(),Button2Up=fakeEvent(),Button2Down=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 then | |
34 | for _,f in pairs(t.Functions) do | |
35 | f(...) | |
36 | end | |
37 | end | |
38 | end | |
39 | m.TrigEvent = te | |
40 | UIS.TrigEvent = te | |
41 | ||
42 | Event.OnServerEvent:Connect(function(plr,io) | |
43 | if plr~=rp then return end | |
44 | m.Target = io.Target | |
45 | m.Hit = io.Hit | |
46 | if not io.isMouse then | |
47 | local b = io.UserInputState == Enum.UserInputState.Begin | |
48 | if io.UserInputType == Enum.UserInputType.MouseButton1 then | |
49 | return m:TrigEvent(b and "Button1Down" or "Button1Up") | |
50 | end | |
51 | if io.UserInputType == Enum.UserInputType.MouseButton2 then | |
52 | return m:TrigEvent(b and "Button2Down" or "Button2Up") | |
53 | end | |
54 | for _,t in pairs(CAS.Actions) do | |
55 | for _,k in pairs(t.Keys) do | |
56 | if k==io.KeyCode then | |
57 | t.Function(t.Name,io.UserInputState,io) | |
58 | end | |
59 | end | |
60 | end | |
61 | m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) | |
62 | UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false) | |
63 | end | |
64 | end) | |
65 | Event.Parent = NLS([==[ | |
66 | local Player = game:GetService("Players").LocalPlayer | |
67 | local Event = script:WaitForChild("UserInput_Event") | |
68 | local Mouse = Player:GetMouse() | |
69 | local UIS = game:GetService("UserInputService") | |
70 | local input = function(io,a) | |
71 | if a then return end | |
72 | --Since InputObject is a client-side instance, we create and pass table instead | |
73 | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target}) | |
74 | end | |
75 | UIS.InputBegan:Connect(input) | |
76 | UIS.InputEnded:Connect(input) | |
77 | local h,t | |
78 | --Give the server mouse data 30 times every second, but only if the values changed | |
79 | --If player is not moving their mouse, client won't fire events | |
80 | while wait(1/30) do | |
81 | if h~=Mouse.Hit or t~=Mouse.Target then | |
82 | h,t=Mouse.Hit,Mouse.Target | |
83 | Event:FireServer({isMouse=true,Target=t,Hit=h}) | |
84 | end | |
85 | end]==],Player.Character) | |
86 | ||
87 | ----Sandboxed game object that allows the usage of client-side methods and services | |
88 | --Real game object | |
89 | local _rg = game | |
90 | ||
91 | --Metatable for fake service | |
92 | local fsmt = { | |
93 | __index = function(self,k) | |
94 | local s = rawget(self,"_RealService") | |
95 | if s then | |
96 | return typeof(s[k])=="function" | |
97 | and function(_,...)return s[k](s,...)end or s[k] | |
98 | end | |
99 | end, | |
100 | __newindex = function(self,k,v) | |
101 | local s = rawget(self,"_RealService") | |
102 | if s then s[k]=v end | |
103 | end | |
104 | } | |
105 | local function FakeService(t,RealService) | |
106 | t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService | |
107 | return setmetatable(t,fsmt) | |
108 | end | |
109 | ||
110 | --Fake game object | |
111 | local g = { | |
112 | GetService = function(self,s) | |
113 | return rawget(self,s) or _rg:GetService(s) | |
114 | end, | |
115 | Players = FakeService({ | |
116 | LocalPlayer = FakeService({GetMouse=function(self)return m end},Player) | |
117 | },"Players"), | |
118 | UserInputService = FakeService(UIS,"UserInputService"), | |
119 | ContextActionService = FakeService(CAS,"ContextActionService"), | |
120 | RunService = FakeService({ | |
121 | _btrs = {}, | |
122 | RenderStepped = _rg:GetService("RunService").Heartbeat, | |
123 | BindToRenderStep = function(self,name,_,fun) | |
124 | self._btrs[name] = self.Heartbeat:Connect(fun) | |
125 | end, | |
126 | UnbindFromRenderStep = function(self,name) | |
127 | self._btrs[name]:Disconnect() | |
128 | end, | |
129 | },"RunService") | |
130 | } | |
131 | rawset(g.Players,"localPlayer",g.Players.LocalPlayer) | |
132 | g.service = g.GetService | |
133 | FakeService(g,game) | |
134 | --Changing owner to fake player object to support owner:GetMouse() | |
135 | game,owner = g,g.Players.LocalPlayer | |
136 | end | |
137 | ||
138 | plr = owner | |
139 | mouse = plr:GetMouse() | |
140 | char = plr.Character | |
141 | hum = char.HumanoidRootPart | |
142 | root = char.Torso | |
143 | left = char["Left Arm"] | |
144 | right = char["Right Arm"] | |
145 | rightl = char["Right Leg"] | |
146 | leftl = char["Left Leg"] | |
147 | ||
148 | --Converted with ttyyuu12345's model to script plugin v4 | |
149 | function sandbox(var,func) | |
150 | local env = getfenv(func) | |
151 | local newenv = setmetatable({},{ | |
152 | __index = function(self,k) | |
153 | if k=="script" then | |
154 | return var | |
155 | else | |
156 | return env[k] | |
157 | end | |
158 | end, | |
159 | }) | |
160 | setfenv(func,newenv) | |
161 | return func | |
162 | end | |
163 | cors = {} | |
164 | mas = Instance.new("Model",game:GetService("Lighting")) | |
165 | Part1 = Instance.new("Part") | |
166 | SpecialMesh2 = Instance.new("SpecialMesh") | |
167 | ManualWeld3 = Instance.new("ManualWeld") | |
168 | Part4 = Instance.new("Part") | |
169 | BlockMesh5 = Instance.new("BlockMesh") | |
170 | Decal6 = Instance.new("Decal") | |
171 | Decal7 = Instance.new("Decal") | |
172 | Tool0 = Instance.new("Tool") | |
173 | Tool0.Name = "Stop sign" | |
174 | Tool0.ToolTip = "STOP FOR THE LOVE OF GOD! (Does nothing)" | |
175 | Tool0.Parent = owner.Backpack | |
176 | Tool0.Grip = CFrame.new(0, -3, 0, 1, 0, 0, 1, 5, 9, 0, 60, -1) | |
177 | Tool0.GripForward = Vector3.new(-0, -0, 0.3) | |
178 | Tool0.GripRight = Vector3.new(1, 0, 0) | |
179 | Part1.Name = "Handle" | |
180 | Part1.Parent = Tool0 | |
181 | Part1.Collide = false | |
182 | Part1.CFrame = CFrame.new(-4.55999279, 4.00001097, -36.8499832, 4.7679805e-08, 5.83796114e-14, 1, -2.05022985e-07, 1, -5.68434189e-14, -1, -2.05022985e-07, 4.7679805e-08) | |
183 | Part1.Orientation = Vector3.new(0, 90, 0) | |
184 | Part1.Position = Vector3.new(-4.55999279, 4.00001097, -36.8499832) | |
185 | Part1.Rotation = Vector3.new(0, 90, 0) | |
186 | Part1.Size = Vector3.new(1, 8, 1) | |
187 | Part1.Anchored = false | |
188 | Part1.BottomSurface = Enum.SurfaceType.Smooth | |
189 | Part1.TopSurface = Enum.SurfaceType.Smooth | |
190 | Part1.FormFactor = Enum.FormFactor.Symmetric | |
191 | Part1.formFactor = Enum.FormFactor.Symmetric | |
192 | SpecialMesh2.Parent = Part1 | |
193 | SpecialMesh2.Scale = Vector3.new(0.5, 1.20000005, 0.5) | |
194 | ManualWeld3.Name = "Part-to-Sign Strong Joint" | |
195 | ManualWeld3.Parent = Part1 | |
196 | ManualWeld3.C0 = CFrame.new(0.5, -4, -0.5, -1, 0, 0, 0, 1, 0, 0, 0, -1) | |
197 | ManualWeld3.C1 = CFrame.new(-0.5, -6.50000048, -0.5, 1, -2.62090509e-08, -1.78814219e-07, 2.62090651e-08, 1, 2.4138609e-07, 1.78814275e-07, -2.4138609e-07, 1) | |
198 | ManualWeld3.Part0 = Part1 | |
199 | ManualWeld3.Part1 = Part4 | |
200 | ManualWeld3.part1 = Part4 | |
201 | Part4.Name = "Sign" | |
202 | Part4.Collide = false | |
203 | Part4.Parent =Tool0 | |
204 | Part4.CFrame = CFrame.new(-5.55999279, 6.49995804, -36.8499832, 1.31134414e-07, -2.41386005e-07, -1, 1.78813934e-07, 1, -2.41386005e-07, 1, -1.7881392e-07, 1.31134527e-07) | |
205 | Part4.Orientation = Vector3.new(0, -90, 0) | |
206 | Part4.Position = Vector3.new(-5.55999279, 6.49995804, -36.8499832) | |
207 | Part4.Rotation = Vector3.new(0, -90, 0) | |
208 | Part4.Color = Color3.new(0.960784, 0.803922, 0.188235) | |
209 | Part4.Transparency = 1 | |
210 | Part4.Size = Vector3.new(3, 3, 1) | |
211 | Part4.Anchored = false | |
212 | Part4.BottomSurface = Enum.SurfaceType.Smooth | |
213 | Part4.BrickColor = BrickColor.new("Bright yellow") | |
214 | Part4.TopSurface = Enum.SurfaceType.Smooth | |
215 | Part4.brickColor = BrickColor.new("Bright yellow") | |
216 | Part4.FormFactor = Enum.FormFactor.Symmetric | |
217 | Part4.formFactor = Enum.FormFactor.Symmetric | |
218 | BlockMesh5.Parent = Part4 | |
219 | BlockMesh5.Offset = Vector3.new(0, 0, -0.74000001) | |
220 | BlockMesh5.Scale = Vector3.new(1.5, 1.5, 0) | |
221 | Decal6.Parent = Part4 | |
222 | Decal6.Texture = "http://www.roblox.com/asset/?id=116620938" | |
223 | Decal6.Face = Enum.NormalId.Back | |
224 | Decal7.Parent = Part4 | |
225 | Decal7.Texture = "http://www.roblox.com/asset/?id=116620941" | |
226 | for i,v in pairs(mas:GetChildren()) do | |
227 | v.Parent = script | |
228 | pcall(function() v:MakeJoints() end) | |
229 | end | |
230 | mas:Destroy() | |
231 | for i,v in pairs(cors) do | |
232 | spawn(function() | |
233 | pcall(v) | |
234 | end) | |
235 | end |