SHOW:
|
|
- or go back to the newest paste.
1 | - | -- This script has been converted to FE by iPxter |
1 | + | --just put this on the top of a script and boom 89% works |
2 | --note this does not work on big scripts | |
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 Player,Mouse,mouse,UserInputService,ContextActionService = owner |
5 | + | local RealPlayer = Player |
6 | do | |
7 | - | print("FE Compatibility code by Mokiros | Translated to FE by iPxter") |
7 | + | local rp = RealPlayer |
8 | - | script.Parent = Player.Character |
8 | + | script.Parent = rp.Character |
9 | ||
10 | - | --RemoteEvent for communicating |
10 | + | --RemoteEvent for communicating |
11 | - | local Event = Instance.new("RemoteEvent") |
11 | + | local Event = Instance.new("RemoteEvent") |
12 | - | Event.Name = "UserInput_Event" |
12 | + | Event.Name = "UserInput_Event" |
13 | ||
14 | - | --Fake event to make stuff like Mouse.KeyDown work |
14 | + | --Fake event to make stuff like Mouse.KeyDown work |
15 | - | local function fakeEvent() |
15 | + | local function fakeEvent() |
16 | - | local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end} |
16 | + | local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end} |
17 | - | t.connect = t.Connect |
17 | + | t.connect = t.Connect |
18 | - | return t |
18 | + | return t |
19 | - | end |
19 | + | end |
20 | ||
21 | - | --Creating fake input objects with fake variables |
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()} |
23 | + | local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()} |
24 | - | local CAS = {Actions={},BindAction=function(self,name,fun,touch,...) |
24 | + | local CAS = {Actions={},BindAction=function(self,name,fun,touch,...) |
25 | - | CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil |
25 | + | CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil |
26 | - | end} |
26 | + | end} |
27 | - | --Merged 2 functions into one by checking amount of arguments |
27 | + | --Merged 2 functions into one by checking amount of arguments |
28 | - | CAS.UnbindAction = CAS.BindAction |
28 | + | CAS.UnbindAction = CAS.BindAction |
29 | ||
30 | - | --This function will trigger the events that have been :Connect()'ed |
30 | + | --This function will trigger the events that have been :Connect()'ed |
31 | - | local function te(self,ev,...) |
31 | + | local function te(self,ev,...) |
32 | - | local t = m[ev] |
32 | + | local t = m[ev] |
33 | - | if t and t._fakeEvent and t.Function then |
33 | + | if t and t._fakeEvent then |
34 | - | t.Function(...) |
34 | + | for _,f in pairs(t.Functions) do |
35 | - | end |
35 | + | f(...) |
36 | - | end |
36 | + | end |
37 | - | m.TrigEvent = te |
37 | + | end |
38 | - | UIS.TrigEvent = te |
38 | + | end |
39 | m.TrigEvent = te | |
40 | - | Event.OnServerEvent:Connect(function(plr,io) |
40 | + | UIS.TrigEvent = te |
41 | - | if plr~=Player then return end |
41 | + | |
42 | - | if io.isMouse then |
42 | + | Event.OnServerEvent:Connect(function(plr,io) |
43 | - | m.Target = io.Target |
43 | + | if plr~=rp then return end |
44 | - | m.Hit = io.Hit |
44 | + | m.Target = io.Target |
45 | - | else |
45 | + | m.Hit = io.Hit |
46 | - | local b = io.UserInputState == Enum.UserInputState.Begin |
46 | + | if not io.isMouse then |
47 | - | if io.UserInputType == Enum.UserInputType.MouseButton1 then |
47 | + | local b = io.UserInputState == Enum.UserInputState.Begin |
48 | - | return m:TrigEvent(b and "Button1Down" or "Button1Up") |
48 | + | if io.UserInputType == Enum.UserInputType.MouseButton1 then |
49 | - | end |
49 | + | return m:TrigEvent(b and "Button1Down" or "Button1Up") |
50 | - | for _,t in pairs(CAS.Actions) do |
50 | + | end |
51 | - | for _,k in pairs(t.Keys) do |
51 | + | for _,t in pairs(CAS.Actions) do |
52 | - | if k==io.KeyCode then |
52 | + | for _,k in pairs(t.Keys) do |
53 | - | t.Function(t.Name,io.UserInputState,io) |
53 | + | if k==io.KeyCode then |
54 | - | end |
54 | + | t.Function(t.Name,io.UserInputState,io) |
55 | - | end |
55 | + | end |
56 | - | end |
56 | + | end |
57 | - | m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) |
57 | + | end |
58 | - | UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false) |
58 | + | m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) |
59 | - | end |
59 | + | UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false) |
60 | - | end) |
60 | + | end |
61 | - | Event.Parent = NLS([==[ |
61 | + | end) |
62 | - | local Player = game:GetService("Players").LocalPlayer |
62 | + | Event.Parent = NLS([==[ |
63 | - | local Event = script:WaitForChild("UserInput_Event") |
63 | + | local Player = game:GetService("Players").LocalPlayer |
64 | local Event = script:WaitForChild("UserInput_Event") | |
65 | - | local UIS = game:GetService("UserInputService") |
65 | + | |
66 | - | local input = function(io,a) |
66 | + | local Mouse = Player:GetMouse() |
67 | - | if a then return end |
67 | + | local UIS = game:GetService("UserInputService") |
68 | - | --Since InputObject is a client-side instance, we create and pass table instead |
68 | + | local input = function(io,a) |
69 | - | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState}) |
69 | + | if a then return end |
70 | - | end |
70 | + | --Since InputObject is a client-side instance, we create and pass table instead |
71 | - | UIS.InputBegan:Connect(input) |
71 | + | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target}) |
72 | - | UIS.InputEnded:Connect(input) |
72 | + | end |
73 | UIS.InputBegan:Connect(input) | |
74 | - | local Mouse = Player:GetMouse() |
74 | + | UIS.InputEnded:Connect(input) |
75 | - | local h,t |
75 | + | |
76 | - | --Give the server mouse data 30 times every second, but only if the values changed |
76 | + | local h,t |
77 | - | --If player is not moving their mouse, client won't fire events |
77 | + | --Give the server mouse data 30 times every second, but only if the values changed |
78 | - | while wait(1/30) do |
78 | + | --If player is not moving their mouse, client won't fire events |
79 | - | if h~=Mouse.Hit or t~=Mouse.Target then |
79 | + | while wait(1/30) do |
80 | - | h,t=Mouse.Hit,Mouse.Target |
80 | + | if h~=Mouse.Hit or t~=Mouse.Target then |
81 | - | Event:FireServer({isMouse=true,Target=t,Hit=h}) |
81 | + | h,t=Mouse.Hit,Mouse.Target |
82 | - | end |
82 | + | Event:FireServer({isMouse=true,Target=t,Hit=h}) |
83 | - | end]==],Player.Character) |
83 | + | end |
84 | - | Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS |
84 | + | end]==],Player.Character) |
85 | ||
86 | ----Sandboxed game object that allows the usage of client-side methods and services | |
87 | - | --=============== |
87 | + | --Real game object |
88 | local _rg = game | |
89 | ||
90 | --Metatable for fake service | |
91 | - | who = owner.Name |
91 | + | local fsmt = { |
92 | __index = function(self,k) | |
93 | local s = rawget(self,"_RealService") | |
94 | if s then return s[k] end | |
95 | end, | |
96 | - | local colors = {"Reddish brown", "Light orange", "Bright yellow", "Dark green", "Bright green"} |
96 | + | __newindex = function(self,k,v) |
97 | local s = rawget(self,"_RealService") | |
98 | if s then s[k]=v end | |
99 | end, | |
100 | __call = function(self,...) | |
101 | local s = rawget(self,"_RealService") | |
102 | if s then return s(...) 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 | - | torsom.MeshId = "http://www.roblox.com/asset/?id=16657069" |
113 | + | return self[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 | - | local larm = Instance.new("Weld") |
120 | + | } |
121 | - | larm.Parent = mod |
121 | + | rawset(g.Players,"localPlayer",g.Players.LocalPlayer) |
122 | - | larm.Part0 = char["Left Arm"] |
122 | + | g.service = g.GetService |
123 | - | larm.Part1 = torso |
123 | + | |
124 | - | larm.C0 = CFrame.new(1, -1, -0.5) * CFrame.Angles(-0.5, 0, -0.25) |
124 | + | g.RunService = FakeService({ |
125 | - | local rarm = Instance.new("Weld") |
125 | + | RenderStepped = _rg:GetService("RunService").Heartbeat, |
126 | - | rarm.Parent = mod |
126 | + | BindToRenderStep = function(self,name,_,fun) |
127 | - | rarm.Part0 = char["Right Arm"] |
127 | + | self._btrs[name] = self.Heartbeat:Connect(fun) |
128 | - | rarm.Part1 = torso |
128 | + | end, |
129 | - | rarm.C0 = CFrame.new(-1, -1, -0.5) * CFrame.Angles(-0.5, 0, 0.25) |
129 | + | UnbindFromRenderStep = function(self,name) |
130 | self._btrs[name]:Disconnect() | |
131 | end, | |
132 | },"RunService") | |
133 | ||
134 | setmetatable(g,{ | |
135 | __index=function(self,s) | |
136 | return _rg:GetService(s) or typeof(_rg[s])=="function" | |
137 | and function(_,...)return _rg[s](_rg,...)end or _rg[s] | |
138 | - | torsow.C1 = CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(40*i), 0, 0) |
138 | + | end, |
139 | - | head.C1 = CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-20*i), 0, 0) |
139 | + | __newindex = fsmt.__newindex, |
140 | __call = fsmt.__call | |
141 | }) | |
142 | --Changing owner to fake player object to support owner:GetMouse() | |
143 | game,owner = g,g.Players.LocalPlayer | |
144 | end | |
145 | ||
146 | ||
147 | --http://www.roblox.com/asset/?id=16657069 | |
148 | - | bg.maxTorque = Vector3.new(0, 0, 0) |
148 | + | who = game.Players.LocalPlayer.Name |
149 | - | for i = 0, math.random(5, 10), 0.1 do |
149 | + | |
150 | me = players[who] | |
151 | char = me.Character | |
152 | ||
153 | local colors = {"Bright green", "Bright orange", "Bright yellow", "Bright red", "Cyan", "Bright blue", "Carnation pink", "Eggplant", "Fire yellow"} | |
154 | ||
155 | - | barf.Size = Vector3.new(math.random(0.2, 1), math.random(0.2, 1), math.random(0.2, 1)) |
155 | + | |
156 | - | barf.CanCollide = false |
156 | + | |
157 | - | barf.CFrame = torso.CFrame + Vector3.new(math.random(-0.5, 0.5), math.random(-0.5, 0.5), math.random(-0.5, 0.5)) |
157 | + | |
158 | ||
159 | local torso = Instance.new("Part") | |
160 | torso.Parent = mod | |
161 | torso.Anchored = false | |
162 | torso.CanCollide = false | |
163 | torso.BrickColor = BrickColor.new("Reddish brown") | |
164 | torso.Size = Vector3.new(2, 2, 1) | |
165 | - | torsow.C1 = CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(40-40*i), 0, 0) |
165 | + | |
166 | - | head.C1 = CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-20+20*i), 0, 0) |
166 | + | |
167 | local torsom = Instance.new("SpecialMesh") | |
168 | torsom.Parent = torso | |
169 | torsom.MeshType = "FileMesh" | |
170 | torsom.MeshId = "http://www.roblox.com/asset/?id=0000000" | |
171 | - | for _,v in pairs(mod:GetChildren()) do |
171 | + | |
172 | - | if v.Name == "BARF" then |
172 | + | |
173 | - | v:remove() |
173 | + | |
174 | torsow.Part0 = torso | |
175 | torsow.Part1 = char.Torso | |
176 | torsow.C0 = CFrame.new(0, 0.25, 1.5) * CFrame.Angles(0, 0, 0) | |
177 | ||
178 | local head = Instance.new("Weld") | |
179 | head.Parent = mod | |
180 | head.Part0 = char["Head"] | |
181 | head.Part1 = char["Torso"] | |
182 | head.C0 = CFrame.new(0, -1.5, 0) * CFrame.Angles(0, 0, 0) | |
183 | ||
184 | while wait(math.random(3, 10)) do | |
185 | for i = 0, 1, 0.1 do | |
186 | torsow.C1 = CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-00*i), 0, 0) | |
187 | head.C1 = CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(20*i), 0, 0) | |
188 | wait() | |
189 | end | |
190 | bv = Instance.new("BodyAngularVelocity") | |
191 | bv.Parent = char.Torso | |
192 | bv.angularvelocity = Vector3.new(0, 20, 0) | |
193 | bv.maxTorque = Vector3.new(math.huge, math.huge, math.huge) | |
194 | bg = Instance.new("BodyGyro") | |
195 | bg.Parent = char.Torso | |
196 | bg.maxTorque = Vector3.new(10, 0, 0) | |
197 | for i = 0, math.random(15, 15), 0.1 do | |
198 | local barf = Instance.new("Part") | |
199 | barf.formFactor = "Custom" | |
200 | barf.Material = 'Neon' | |
201 | barf.BrickColor = BrickColor.new(colors[math.random(1, #colors)]) | |
202 | barf.Parent = mod | |
203 | barf.Name = "BARF" | |
204 | ||
205 | ||
206 | barf.Size = Vector3.new(math.random(1, 1), math.random(1, 1), math.random(1, 1)) | |
207 | barf.CanCollide = true | |
208 | barf.CFrame = torso.CFrame + Vector3.new(math.random(- 0.5, .5), math.random(2, 2), math.random(-0.5, 0.5)) | |
209 | local bm = Instance.new("BlockMesh", barf) | |
210 | barf:BreakJoints() | |
211 | barf.CanCollide = true | |
212 | wait() | |
213 | end | |
214 | wait(math.random(0.5, 1.5)) | |
215 | for i = 0, 1, 0.1 do | |
216 | torsow.C1 = CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-00+00*i), 0, 0) | |
217 | head.C1 = CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(20-20*i), 0, 0) | |
218 | wait() | |
219 | end | |
220 | bv:remove() | |
221 | bg:remove() | |
222 | ||
223 | wait(10) | |
224 | for _,v in pairs(mod:GetChildren()) do | |
225 | if v.Name == "BARF" then | |
226 | v:remove() | |
227 | end | |
228 | wait() | |
229 | end | |
230 | end |