SHOW:
|
|
- or go back to the newest paste.
1 | --https://github.com/Mokiros/roblox-FE-compatibility | |
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,Mouse,mouse,UserInputService,ContextActionService = owner | |
4 | - | do |
4 | + | local RealPlayer = Player |
5 | - | print("FE Compatibility code by Mokiros") |
5 | + | do print("FE Compatibility code by Mokiros")local a=RealPlayer;script.Parent=a.Character;local b=Instance.new("RemoteEvent")b.Name="UserInput_Event"local function c()local d={_fakeEvent=true,Functions={},Connect=function(self,e)table.insert(self.Functions,e)end}d.connect=d.Connect;return d end;local f={Target=nil,Hit=CFrame.new(),KeyUp=c(),KeyDown=c(),Button1Up=c(),Button1Down=c(),Button2Up=c(),Button2Down=c()}local g={InputBegan=c(),InputEnded=c()}local CAS={Actions={},BindAction=function(self,h,i,j,...)CAS.Actions[h]=i and{Name=h,Function=i,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function k(self,l,...)local d=f[l]if d and d._fakeEvent then for m,e in pairs(d.Functions)do e(...)end end end;f.TrigEvent=k;g.TrigEvent=k;b.OnServerEvent:Connect(function(n,o)if n~=a then return end;f.Target=o.Target;f.Hit=o.Hit;if not o.isMouse then local p=o.UserInputState==Enum.UserInputState.Begin;if o.UserInputType==Enum.UserInputType.MouseButton1 then return f:TrigEvent(p and"Button1Down"or"Button1Up")end;if o.UserInputType==Enum.UserInputType.MouseButton2 then return f:TrigEvent(p and"Button2Down"or"Button2Up")end;for m,d in pairs(CAS.Actions)do for m,q in pairs(d.Keys)do if q==o.KeyCode then d.Function(d.Name,o.UserInputState,o)end end end;f:TrigEvent(p and"KeyDown"or"KeyUp",o.KeyCode.Name:lower())g:TrigEvent(p and"InputBegan"or"InputEnded",o,false)end end)b.Parent=NLS([==[local a=game:GetService("Players").LocalPlayer;local b=script:WaitForChild("UserInput_Event")local c=a:GetMouse()local d=game:GetService("UserInputService")local e=function(f,g)if g then return end;b:FireServer({KeyCode=f.KeyCode,UserInputType=f.UserInputType,UserInputState=f.UserInputState,Hit=c.Hit,Target=c.Target})end;d.InputBegan:Connect(e)d.InputEnded:Connect(e)local h,i;while wait(1/30)do if h~=c.Hit or i~=c.Target then h,i=c.Hit,c.Target;b:FireServer({isMouse=true,Target=i,Hit=h})end end]==],Player.Character)local r=game;local s={__index=function(self,q)local t=rawget(self,"_RealService")if t then return typeof(t[q])=="function"and function(m,...)return t[q](t,...)end or t[q]end end,__newindex=function(self,q,u)local t=rawget(self,"_RealService")if t then t[q]=u end end}local function v(d,w)d._RealService=typeof(w)=="string"and r:GetService(w)or w;return setmetatable(d,s)end;local x={GetService=function(self,t)return rawget(self,t)or r:GetService(t)end,Players=v({LocalPlayer=v({GetMouse=function(self)return f end},Player)},"Players"),UserInputService=v(g,"UserInputService"),ContextActionService=v(CAS,"ContextActionService"),RunService=v({_btrs={},RenderStepped=r:GetService("RunService").Heartbeat,BindToRenderStep=function(self,h,m,i)self._btrs[h]=self.Heartbeat:Connect(i)end,UnbindFromRenderStep=function(self,h)self._btrs[h]:Disconnect()end},"RunService")}rawset(x.Players,"localPlayer",x.Players.LocalPlayer)x.service=x.GetService;v(x,game)game,owner=x,x.Players.LocalPlayer end |
6 | - | script.Parent = Player.Character |
6 | + | |
7 | - | |
7 | + | plr = game.Players.LocalPlayer |
8 | - | --RemoteEvent for communicating |
8 | + | repeat wait() until plr.Character |
9 | - | local Event = Instance.new("RemoteEvent") |
9 | + | |
10 | - | Event.Name = "UserInput_Event" |
10 | + | |
11 | - | |
11 | + | |
12 | - | --Fake event to make stuff like Mouse.KeyDown work |
12 | + | |
13 | - | local function fakeEvent() |
13 | + | |
14 | - | local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end} |
14 | + | |
15 | - | t.connect = t.Connect |
15 | + | |
16 | - | return t |
16 | + | |
17 | - | end |
17 | + | |
18 | - | |
18 | + | |
19 | - | --Creating fake input objects with fake variables |
19 | + | |
20 | - | local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()} |
20 | + | |
21 | - | local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()} |
21 | + | |
22 | - | local CAS = {Actions={},BindAction=function(self,name,fun,touch,...) |
22 | + | |
23 | - | CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil |
23 | + | |
24 | - | end} |
24 | + | |
25 | - | --Merged 2 functions into one by checking amount of arguments |
25 | + | |
26 | - | CAS.UnbindAction = CAS.BindAction |
26 | + | |
27 | - | |
27 | + | |
28 | - | --This function will trigger the events that have been :Connect()'ed |
28 | + | |
29 | - | local function te(self,ev,...) |
29 | + | |
30 | - | local t = m[ev] |
30 | + | |
31 | - | if t and t._fakeEvent and t.Function then |
31 | + | |
32 | - | t.Function(...) |
32 | + | |
33 | - | end |
33 | + | |
34 | - | end |
34 | + | |
35 | - | m.TrigEvent = te |
35 | + | |
36 | - | UIS.TrigEvent = te |
36 | + | |
37 | - | |
37 | + | |
38 | - | Event.OnServerEvent:Connect(function(plr,io) |
38 | + | |
39 | - | if plr~=Player then return end |
39 | + | |
40 | - | if io.isMouse then |
40 | + | |
41 | - | m.Target = io.Target |
41 | + | |
42 | - | m.Hit = io.Hit |
42 | + | |
43 | - | else |
43 | + | |
44 | - | local b = io.UserInputState == Enum.UserInputState.Begin |
44 | + | |
45 | - | if io.UserInputType == Enum.UserInputType.MouseButton1 then |
45 | + | |
46 | - | return m:TrigEvent(b and "Button1Down" or "Button1Up") |
46 | + | |
47 | - | end |
47 | + | |
48 | - | for _,t in pairs(CAS.Actions) do |
48 | + | |
49 | - | for _,k in pairs(t.Keys) do |
49 | + | |
50 | - | if k==io.KeyCode then |
50 | + | |
51 | - | t.Function(t.Name,io.UserInputState,io) |
51 | + | |
52 | - | end |
52 | + | |
53 | - | end |
53 | + | |
54 | - | end |
54 | + | |
55 | - | m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) |
55 | + | |
56 | - | UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false) |
56 | + | |
57 | - | end |
57 | + | |
58 | - | end) |
58 | + | |
59 | - | Event.Parent = NLS([==[ |
59 | + | |
60 | - | local Player = game:GetService("Players").LocalPlayer |
60 | + | |
61 | - | local Event = script:WaitForChild("UserInput_Event") |
61 | + | |
62 | - | |
62 | + | |
63 | - | local UIS = game:GetService("UserInputService") |
63 | + | |
64 | - | local input = function(io,a) |
64 | + | |
65 | - | if a then return end |
65 | + | |
66 | - | --Since InputObject is a client-side instance, we create and pass table instead |
66 | + | |
67 | - | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState}) |
67 | + | |
68 | - | end |
68 | + | |
69 | - | UIS.InputBegan:Connect(input) |
69 | + | |
70 | - | UIS.InputEnded:Connect(input) |
70 | + | |
71 | - | |
71 | + | |
72 | - | local Mouse = Player:GetMouse() |
72 | + | |
73 | - | local h,t |
73 | + | |
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 | + | |
76 | - | while wait(1/30) do |
76 | + | |
77 | - | if h~=Mouse.Hit or t~=Mouse.Target then |
77 | + | |
78 | - | h,t=Mouse.Hit,Mouse.Target |
78 | + | game:GetService("RunService").RenderStepped:wait() |
79 | - | Event:FireServer({isMouse=true,Target=t,Hit=h}) |
79 | + | |
80 | - | end |
80 | + | |
81 | - | end]==],Player.Character) |
81 | + | |
82 | - | Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS |
82 | + | |
83 | 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) | |
84 | - | plr = owner |
84 | + | |
85 | 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) | |
86 | game:GetService("RunService").RenderStepped:wait() | |
87 | - | print("this dance is so good i had to") |
87 | + | |
88 | - | print("Made by Theamazingnater") |
88 | + | |
89 | human2.C0 = human2.C0:lerp(human2co,i) | |
90 | 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) | |
91 | 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) | |
92 | rlegweld.C0 = rlegweld.C0:lerp(CFrame.new(-0.5, -2, 0, 1, 0, 0, 0, 0.999999881, 0, 0, 0, 1),i) | |
93 | llegweld.C0 = llegweld.C0:lerp(CFrame.new(0.5, -2, 0, 1, 0, 0, 0, 0.999999881, 0, 0, 0, 1),i) | |
94 | game:GetService("RunService").RenderStepped:wait() | |
95 | end | |
96 | for i = 0,1 ,0.05 do | |
97 | human2.C0 = human2.C0:lerp(human2co,i) | |
98 | 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) | |
99 | 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) | |
100 | rlegweld.C0 = rlegweld.C0:lerp(CFrame.new(-0.5, -2, 0, 1, 0, 0, 0, 0.999999881, 0, 0, 0, 1),i) | |
101 | llegweld.C0 = llegweld.C0:lerp(CFrame.new(0.5, -2, 0, 1, 0, 0, 0, 0.999999881, 0, 0, 0, 1),i) | |
102 | game:GetService("RunService").RenderStepped:wait() | |
103 | end | |
104 | end |