SHOW:
|
|
- or go back to the newest paste.
1 | -- this dance is so good i had to | |
2 | - | if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end |
2 | + | plr = game.Players.LocalPlayer |
3 | - | local Player,Mouse,mouse,UserInputService,ContextActionService = owner |
3 | + | repeat wait() until plr.Character |
4 | - | do |
4 | + | |
5 | - | print("FE Compatibility code by Mokiros") |
5 | + | |
6 | - | script.Parent = Player.Character |
6 | + | |
7 | - | |
7 | + | |
8 | - | --RemoteEvent for communicating |
8 | + | |
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 | + | game:GetService("RunService").RenderStepped:wait() |
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 | + | |
79 | - | Event:FireServer({isMouse=true,Target=t,Hit=h}) |
79 | + | |
80 | - | end |
80 | + | |
81 | - | end]==],Player.Character) |
81 | + | game:GetService("RunService").RenderStepped:wait() |
82 | - | Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS |
82 | + | |
83 | for i = 0,1 ,0.05 do | |
84 | - | plr = owner |
84 | + | |
85 | 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) | |
86 | 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) | |
87 | - | print("this dance is so good i had to") |
87 | + | |
88 | - | print("Made by Theamazingnater") |
88 | + | |
89 | game:GetService("RunService").RenderStepped:wait() | |
90 | end | |
91 | for i = 0,1 ,0.05 do | |
92 | human2.C0 = human2.C0:lerp(human2co,i) | |
93 | 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) | |
94 | 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) | |
95 | rlegweld.C0 = rlegweld.C0:lerp(CFrame.new(-0.5, -2, 0, 1, 0, 0, 0, 0.999999881, 0, 0, 0, 1),i) | |
96 | llegweld.C0 = llegweld.C0:lerp(CFrame.new(0.5, -2, 0, 1, 0, 0, 0, 0.999999881, 0, 0, 0, 1),i) | |
97 | game:GetService("RunService").RenderStepped:wait() | |
98 | end | |
99 | end |