SHOW:
|
|
- or go back to the newest paste.
1 | if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end | |
2 | local Player,game,owner = owner,game | |
3 | - | local Player,Mouse,mouse,UserInputService,ContextActionService = owner |
3 | + | local RealPlayer = Player |
4 | do | |
5 | - | print("FE Compatibility code by Mokiros") |
5 | + | print("FE Compatibility code by Mokiros") |
6 | - | script.Parent = Player.Character |
6 | + | local rp = RealPlayer |
7 | - | |
7 | + | script.Parent = rp.Character |
8 | - | --RemoteEvent for communicating |
8 | + | |
9 | - | local Event = Instance.new("RemoteEvent") |
9 | + | --RemoteEvent for communicating |
10 | - | Event.Name = "UserInput_Event" |
10 | + | local Event = Instance.new("RemoteEvent") |
11 | - | |
11 | + | Event.Name = "UserInput_Event" |
12 | - | --Fake event to make stuff like Mouse.KeyDown work |
12 | + | |
13 | - | local function fakeEvent() |
13 | + | --Fake event to make stuff like Mouse.KeyDown work |
14 | - | local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end} |
14 | + | local function fakeEvent() |
15 | - | t.connect = t.Connect |
15 | + | local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end} |
16 | - | return t |
16 | + | t.connect = t.Connect |
17 | - | end |
17 | + | return t |
18 | - | |
18 | + | |
19 | - | --Creating fake input objects with fake variables |
19 | + | |
20 | --Creating fake input objects with fake variables | |
21 | - | local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()} |
21 | + | |
22 | - | local CAS = {Actions={},BindAction=function(self,name,fun,touch,...) |
22 | + | local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()} |
23 | - | CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil |
23 | + | local CAS = {Actions={},BindAction=function(self,name,fun,touch,...) |
24 | - | end} |
24 | + | CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil |
25 | - | --Merged 2 functions into one by checking amount of arguments |
25 | + | end} |
26 | - | CAS.UnbindAction = CAS.BindAction |
26 | + | --Merged 2 functions into one by checking amount of arguments |
27 | - | |
27 | + | CAS.UnbindAction = CAS.BindAction |
28 | - | --This function will trigger the events that have been :Connect()'ed |
28 | + | |
29 | - | local function te(self,ev,...) |
29 | + | --This function will trigger the events that have been :Connect()'ed |
30 | - | local t = m[ev] |
30 | + | local function te(self,ev,...) |
31 | - | if t and t._fakeEvent and t.Function then |
31 | + | local t = m[ev] |
32 | - | t.Function(...) |
32 | + | if t and t._fakeEvent then |
33 | - | end |
33 | + | for _,f in pairs(t.Functions) do |
34 | - | end |
34 | + | f(...) |
35 | - | m.TrigEvent = te |
35 | + | end |
36 | - | UIS.TrigEvent = te |
36 | + | end |
37 | - | |
37 | + | |
38 | - | Event.OnServerEvent:Connect(function(plr,io) |
38 | + | m.TrigEvent = te |
39 | - | if plr~=Player then return end |
39 | + | UIS.TrigEvent = te |
40 | - | if io.isMouse then |
40 | + | |
41 | - | m.Target = io.Target |
41 | + | Event.OnServerEvent:Connect(function(plr,io) |
42 | - | m.Hit = io.Hit |
42 | + | if plr~=rp then return end |
43 | - | else |
43 | + | m.Target = io.Target |
44 | - | local b = io.UserInputState == Enum.UserInputState.Begin |
44 | + | m.Hit = io.Hit |
45 | - | if io.UserInputType == Enum.UserInputType.MouseButton1 then |
45 | + | if not io.isMouse then |
46 | - | return m:TrigEvent(b and "Button1Down" or "Button1Up") |
46 | + | local b = io.UserInputState == Enum.UserInputState.Begin |
47 | - | end |
47 | + | if io.UserInputType == Enum.UserInputType.MouseButton1 then |
48 | - | for _,t in pairs(CAS.Actions) do |
48 | + | return m:TrigEvent(b and "Button1Down" or "Button1Up") |
49 | - | for _,k in pairs(t.Keys) do |
49 | + | end |
50 | - | if k==io.KeyCode then |
50 | + | for _,t in pairs(CAS.Actions) do |
51 | - | t.Function(t.Name,io.UserInputState,io) |
51 | + | for _,k in pairs(t.Keys) do |
52 | - | end |
52 | + | if k==io.KeyCode then |
53 | - | end |
53 | + | t.Function(t.Name,io.UserInputState,io) |
54 | - | end |
54 | + | end |
55 | - | m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) |
55 | + | end |
56 | - | UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false) |
56 | + | end |
57 | - | end |
57 | + | m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) |
58 | - | end) |
58 | + | UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false) |
59 | - | Event.Parent = NLS([==[ |
59 | + | end |
60 | - | local Player = game:GetService("Players").LocalPlayer |
60 | + | end) |
61 | - | local Event = script:WaitForChild("UserInput_Event") |
61 | + | Event.Parent = NLS([==[ |
62 | - | |
62 | + | local Player = game:GetService("Players").LocalPlayer |
63 | - | local UIS = game:GetService("UserInputService") |
63 | + | local Event = script:WaitForChild("UserInput_Event") |
64 | - | local input = function(io,a) |
64 | + | |
65 | - | if a then return end |
65 | + | local Mouse = Player:GetMouse() |
66 | - | --Since InputObject is a client-side instance, we create and pass table instead |
66 | + | local UIS = game:GetService("UserInputService") |
67 | - | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState}) |
67 | + | local input = function(io,a) |
68 | - | end |
68 | + | if a then return end |
69 | - | UIS.InputBegan:Connect(input) |
69 | + | --Since InputObject is a client-side instance, we create and pass table instead |
70 | - | UIS.InputEnded:Connect(input) |
70 | + | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target}) |
71 | - | |
71 | + | |
72 | - | local Mouse = Player:GetMouse() |
72 | + | UIS.InputBegan:Connect(input) |
73 | - | local h,t |
73 | + | UIS.InputEnded:Connect(input) |
74 | - | --Give the server mouse data 30 times every second, but only if the values changed |
74 | + | |
75 | - | --If player is not moving their mouse, client won't fire events |
75 | + | local h,t |
76 | - | while wait(1/30) do |
76 | + | --Give the server mouse data 30 times every second, but only if the values changed |
77 | - | if h~=Mouse.Hit or t~=Mouse.Target then |
77 | + | --If player is not moving their mouse, client won't fire events |
78 | - | h,t=Mouse.Hit,Mouse.Target |
78 | + | while wait(1/30) do |
79 | - | Event:FireServer({isMouse=true,Target=t,Hit=h}) |
79 | + | if h~=Mouse.Hit or t~=Mouse.Target then |
80 | - | end |
80 | + | h,t=Mouse.Hit,Mouse.Target |
81 | - | end]==],Player.Character) |
81 | + | Event:FireServer({isMouse=true,Target=t,Hit=h}) |
82 | - | Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS |
82 | + | end |
83 | end]==],Player.Character) | |
84 | - | plr = owner |
84 | + | |
85 | ----Sandboxed game object that allows the usage of client-side methods and services | |
86 | --Real game object | |
87 | - | print("this dance is so good i had to") |
87 | + | local _rg = game |
88 | - | print("Made by Theamazingnater") |
88 | + | |
89 | --Metatable for fake service | |
90 | local fsmt = { | |
91 | __index = function(self,k) | |
92 | local s = rawget(self,"_RealService") | |
93 | if s then return s[k] end | |
94 | end, | |
95 | __newindex = function(self,k,v) | |
96 | local s = rawget(self,"_RealService") | |
97 | if s then s[k]=v end | |
98 | end, | |
99 | __call = function(self,...) | |
100 | local s = rawget(self,"_RealService") | |
101 | if s then return s(...) end | |
102 | end | |
103 | } | |
104 | local function FakeService(t,RealService) | |
105 | t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService | |
106 | return setmetatable(t,fsmt) | |
107 | end | |
108 | ||
109 | --Fake game object | |
110 | local g = { | |
111 | GetService = function(self,s) | |
112 | return self[s] | |
113 | end, | |
114 | Players = FakeService({ | |
115 | LocalPlayer = FakeService({GetMouse=function(self)return m end},Player) | |
116 | },"Players"), | |
117 | UserInputService = FakeService(UIS,"UserInputService"), | |
118 | ContextActionService = FakeService(CAS,"ContextActionService"), | |
119 | } | |
120 | rawset(g.Players,"localPlayer",g.Players.LocalPlayer) | |
121 | g.service = g.GetService | |
122 | ||
123 | g.RunService = FakeService({ | |
124 | RenderStepped = _rg:GetService("RunService").Heartbeat, | |
125 | BindToRenderStep = function(self,name,_,fun) | |
126 | self._btrs[name] = self.Heartbeat:Connect(fun) | |
127 | end, | |
128 | UnbindFromRenderStep = function(self,name) | |
129 | self._btrs[name]:Disconnect() | |
130 | end, | |
131 | },"RunService") | |
132 | ||
133 | setmetatable(g,{ | |
134 | __index=function(self,s) | |
135 | return _rg:GetService(s) or typeof(_rg[s])=="function" | |
136 | and function(_,...)return _rg[s](_rg,...)end or _rg[s] | |
137 | end, | |
138 | __newindex = fsmt.__newindex, | |
139 | __call = fsmt.__call | |
140 | }) | |
141 | --Changing owner to fake player object to support owner:GetMouse() | |
142 | game,owner = g,g.Players.LocalPlayer | |
143 | end | |
144 | -- this dance is so good i had to | |
145 | plr = game.Players.LocalPlayer | |
146 | repeat wait() until plr.Character | |
147 | char = plr.Character | |
148 | ||
149 | ||
150 | --[[ | |
151 | Music | |
152 | --]] | |
153 | local Music = Instance.new("Sound",char) | |
154 | Music.SoundId = "rbxassetid://322570310" | |
155 | Music.Volume = 4 | |
156 | - | wait() |
156 | + | |
157 | Music:Play() | |
158 | ||
159 | --[[ | |
160 | Animations/Joints (yay) | |
161 | --]] | |
162 | local neck = Instance.new("Weld",char) | |
163 | neck.Part0 = char.Torso | |
164 | - | wait() |
164 | + | |
165 | neck.C0 = CFrame.new(0, 1.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) | |
166 | local human2 = Instance.new("Weld",char) | |
167 | human2.Part0 = char.HumanoidRootPart | |
168 | human2.Part1 = char.Torso | |
169 | human2co = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) | |
170 | necc = CFrame.new(0, 1.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) | |
171 | local rhandclone = game.Players.LocalPlayer.Character.Torso["Right Shoulder"]:Clone() | |
172 | - | wait() |
172 | + | |
173 | rhandweld.Part0 = game.Players.LocalPlayer.Character.Torso | |
174 | rhandweld.Part1 = game.Players.LocalPlayer.Character["Right Arm"] | |
175 | rhandweld.C0 = CFrame.new(1.5, 0, 0, 1, -1.6395192e-43, 0, -1.6395192e-43, 1, 0, 0, 0, 1) | |
176 | local lhandclone = game.Players.LocalPlayer.Character.Torso["Left Shoulder"]:Clone() | |
177 | local lhandweld = Instance.new("Weld", game.Players.LocalPlayer.Character.Torso) | |
178 | lhandweld.Part0 = game.Players.LocalPlayer.Character.Torso | |
179 | lhandweld.Part1 = game.Players.LocalPlayer.Character["Left Arm"] | |
180 | - | wait() |
180 | + | |
181 | local llegweld = Instance.new("Weld", game.Players.LocalPlayer.Character.Torso) | |
182 | llegweld.Part0 = game.Players.LocalPlayer.Character.Torso | |
183 | llegweld.Part1 = game.Players.LocalPlayer.Character["Left Leg"] | |
184 | llegweld.C0 = CFrame.new(-0.5, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0) * CFrame.new(0,-1,0) | |
185 | local rlegclone = game.Players.LocalPlayer.Character.Torso["Right Hip"]:Clone() | |
186 | game.Players.LocalPlayer.Character.Torso["Right Hip"]:Remove() | |
187 | local rlegweld = Instance.new("Weld", game.Players.LocalPlayer.Character.Torso) | |
188 | rlegweld.Part0 = game.Players.LocalPlayer.Character.Torso | |
189 | rlegweld.Part1 = game.Players.LocalPlayer.Character["Right Leg"] | |
190 | rlegweld.C0 = CFrame.new(0.5, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0) * CFrame.new(0,-1,0) | |
191 | coroutine.wrap(function() | |
192 | while true do | |
193 | wait() | |
194 | if Music.Parent == nil then | |
195 | Music.Parent = char.Torso | |
196 | Music:Resume() | |
197 | end | |
198 | end | |
199 | for i,v in pairs(char:GetChildren()) do | |
200 | if v.ClassName == "Part" then | |
201 | v.Anchored = false | |
202 | end | |
203 | if v.ClassName == "Accessory" then | |
204 | v.Handle.Anchored = false | |
205 | end | |
206 | end | |
207 | end)() | |
208 | while true do | |
209 | wait() | |
210 | for i = 0,1, 0.03 do | |
211 | human2.C0 = human2.C0:lerp(CFrame.new(0, 0, 0, 0.832209826, 0, -0.554460883, 0, 1, 0, 0.554460883, 0, 0.832209826):inverse(),i) | |
212 | rlegweld.C0 = rlegweld.C0:lerp(CFrame.new(0.5, -1.99999988, -1.90734863e-06, 0.538440228, -0.0228908174, 0.842352808, 0.0123270014, 0.999737978, 0.0192881972, -0.842573702, -1.85798854e-06, 0.538581252),i) | |
213 | rhandweld.C0 = rhandweld.C0:lerp(CFrame.new(1.98295307, 0.332087517, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),i) | |
214 | llegweld.C0 = llegweld.C0:lerp(CFrame.new(-0.557174683, -1.44594896, -0.159284592, 0.337842256, 0, -0.941202879, 0, 1, 0, 0.941202879, 0, 0.337842256),i) | |
215 | lhandweld.C0 = lhandweld.C0:lerp(CFrame.new(-1.8871603, 0.277479649, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),i) | |
216 | game:GetService("RunService").RenderStepped:wait() | |
217 | end | |
218 | for i = 0,1 ,0.03 do | |
219 | human2.C0 = human2.C0:lerp(CFrame.new(0, 0, 0, 0.832209826, 0, -0.554460883, 0, 1, 0, 0.554460883, 0, 0.832209826),i) | |
220 | rhandweld.C0 = rhandweld.C0:lerp(CFrame.new(0.737757683, 0.410190105, -0.907682419, 0.803071976, 0.581213236, -0.13140282, 0.00903299917, -0.232366934, -0.972586274, -0.595813632, 0.779869914, -0.191857457),i) | |
221 | rlegweld.C0 = rlegweld.C0:lerp(CFrame.new(0.623174667, -1.35048032, -0.215911865, 0.538440228, -0.0228908174, 0.842352867, 0.0123270014, 0.999737978, 0.0192881972, -0.842573762, -1.85798854e-06, 0.538581252),i) | |
222 | llegweld.C0 = llegweld.C0:lerp(CFrame.new(-0.557173729, -1.97852409, -0.159286499, 0.337842256, 0, -0.941202879, 0, 1, 0, 0.941202879, 0, 0.337842256),i) | |
223 | lhandweld.C0 = lhandweld.C0:lerp(CFrame.new(-1.0623064, 0.181637049, -1.05736732, 0.605673432, -0.693957567, -0.389336228, -0.0272030123, 0.470947832, -0.881741524, 0.79524827, 0.544638515, 0.266362786),i) | |
224 | game:GetService("RunService").RenderStepped:wait() | |
225 | end | |
226 | for i = 0,1 ,0.05 do | |
227 | human2.C0 = human2.C0:lerp(human2co,i) | |
228 | lhandweld.C0 = lhandweld.C0:lerp(CFrame.new(-1.5, 0.422186852, -0.424303055, 0.662418783, 0.749133825, 2.10272674e-06, 0.0236379914, -0.0208990015, -0.999502122, -0.74876076, 0.66208905, -0.031551905),i) | |
229 | rhandweld.C0 = rhandweld.C0:lerp(CFrame.new(1.5, 0.448605061, -0.49020195, 0.830556095, -0.556935072, -2.22774033e-05, 0, 4.00000026e-05, -1, 0.556935072, 0.830556095, 3.32222444e-05),i) | |
230 | rlegweld.C0 = rlegweld.C0:lerp(CFrame.new(-0.5, -2, 0, 1, 0, 0, 0, 0.999999881, 0, 0, 0, 1),i) | |
231 | llegweld.C0 = llegweld.C0:lerp(CFrame.new(0.5, -2, 0, 1, 0, 0, 0, 0.999999881, 0, 0, 0, 1),i) | |
232 | game:GetService("RunService").RenderStepped:wait() | |
233 | end | |
234 | for i = 0,1 ,0.05 do | |
235 | human2.C0 = human2.C0:lerp(human2co,i) | |
236 | lhandweld.C0 = lhandweld.C0:lerp(CFrame.new(-0.672535896, 0.447802067, -1.23580742, 0.686290026, -0.727328002, -3.85612975e-06, -0.0229460001, -0.0216460172, -0.999502361, 0.726966023, 0.685948551, -0.0315447114),i) | |
237 | rhandweld.C0 = rhandweld.C0:lerp(CFrame.new(0.926524162, 0.448590755, -1.28220177, 0.604111135, 0.796900153, 1.11566042e-05, 0, 1.40000038e-05, -1, -0.796900153, 0.604111135, 8.45755858e-06),i) | |
238 | rlegweld.C0 = rlegweld.C0:lerp(CFrame.new(-0.5, -2, 0, 1, 0, 0, 0, 0.999999881, 0, 0, 0, 1),i) | |
239 | llegweld.C0 = llegweld.C0:lerp(CFrame.new(0.5, -2, 0, 1, 0, 0, 0, 0.999999881, 0, 0, 0, 1),i) | |
240 | game:GetService("RunService").RenderStepped:wait() | |
241 | end | |
242 | end |