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
|
| 1 | + | plr = game:GetService("Players").LocalPlayer
|
| 2 | - | local Player,Mouse,mouse,UserInputService,ContextActionService = owner |
| 2 | + | mouse = plr:GetMouse() |
| 3 | - | do |
| 3 | + | |
| 4 | - | print("FE Compatibility code by Mokiros")
|
| 4 | + | |
| 5 | - | script.Parent = Player.Character |
| 5 | + | |
| 6 | - | |
| 6 | + | mouse.KeyDown:connect(function(key) |
| 7 | - | --RemoteEvent for communicating |
| 7 | + | if key == "z" and part == nil then |
| 8 | - | local Event = Instance.new("RemoteEvent")
|
| 8 | + | plr.Character.Torso.CFrame = CFrame.new(Vector3.new(mouse.hit.p.X,mouse.hit.p.Y+1.5,mouse.hit.p.Z),plr.Character.Torso.CFrame.p) |
| 9 | - | Event.Name = "UserInput_Event" |
| 9 | + | elseif key == "x" and plr.Character.Parent == workspace.Camera and part == nil then |
| 10 | - | |
| 10 | + | if plr.Character.Torso.Anchored == true then |
| 11 | - | --Fake event to make stuff like Mouse.KeyDown work |
| 11 | + | for y,t in pairs(plr.Character:GetChildren()) do |
| 12 | - | local function fakeEvent() |
| 12 | + | if t:IsA("Part") then
|
| 13 | - | local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
|
| 13 | + | t.Anchored = false |
| 14 | - | t.connect = t.Connect |
| 14 | + | |
| 15 | - | return t |
| 15 | + | |
| 16 | else | |
| 17 | - | |
| 17 | + | for y,t in pairs(plr.Character:GetChildren()) do |
| 18 | - | --Creating fake input objects with fake variables |
| 18 | + | if t:IsA("Part") then
|
| 19 | - | local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
|
| 19 | + | t.Anchored = true |
| 20 | - | local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
|
| 20 | + | |
| 21 | - | local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
|
| 21 | + | |
| 22 | - | CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
|
| 22 | + | |
| 23 | - | end} |
| 23 | + | elseif key == "c" and plr.Character.Parent == workspace.Camera and part ~= nil then |
| 24 | - | --Merged 2 functions into one by checking amount of arguments |
| 24 | + | local clone = part:Clone() |
| 25 | - | CAS.UnbindAction = CAS.BindAction |
| 25 | + | clone.Parent = workspace |
| 26 | - | |
| 26 | + | clone.Anchored = false |
| 27 | - | --This function will trigger the events that have been :Connect()'ed |
| 27 | + | clone:ClearAllChildren() |
| 28 | - | local function te(self,ev,...) |
| 28 | + | clone.CanCollide = true |
| 29 | - | local t = m[ev] |
| 29 | + | bp.Parent = clone |
| 30 | - | if t and t._fakeEvent and t.Function then |
| 30 | + | particles.Parent = clone |
| 31 | - | t.Function(...) |
| 31 | + | if part.Parent:FindFirstChildOfClass("Humanoid") then
|
| 32 | part.Parent:FindFirstChildOfClass("Humanoid").PlatformStand = false
| |
| 33 | end | |
| 34 | - | m.TrigEvent = te |
| 34 | + | part:Destroy() |
| 35 | - | UIS.TrigEvent = te |
| 35 | + | part = clone |
| 36 | - | |
| 36 | + | |
| 37 | - | Event.OnServerEvent:Connect(function(plr,io) |
| 37 | + | |
| 38 | - | if plr~=Player then return end |
| 38 | + | mouse.Button1Down:connect(function() |
| 39 | - | if io.isMouse then |
| 39 | + | if true then |
| 40 | - | m.Target = io.Target |
| 40 | + | |
| 41 | - | m.Hit = io.Hit |
| 41 | + | |
| 42 | part = mouse.Target | |
| 43 | - | local b = io.UserInputState == Enum.UserInputState.Begin |
| 43 | + | |
| 44 | - | if io.UserInputType == Enum.UserInputType.MouseButton1 then |
| 44 | + | |
| 45 | - | return m:TrigEvent(b and "Button1Down" or "Button1Up") |
| 45 | + | |
| 46 | particles = Instance.new("ParticleEmitter",part)
| |
| 47 | - | for _,t in pairs(CAS.Actions) do |
| 47 | + | |
| 48 | - | for _,k in pairs(t.Keys) do |
| 48 | + | |
| 49 | - | if k==io.KeyCode then |
| 49 | + | |
| 50 | - | t.Function(t.Name,io.UserInputState,io) |
| 50 | + | |
| 51 | - | end |
| 51 | + | |
| 52 | particles.RotSpeed = NumberRange.new(0) | |
| 53 | particles.Rotation = NumberRange.new(0) | |
| 54 | - | m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) |
| 54 | + | |
| 55 | - | UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false) |
| 55 | + | |
| 56 | - | end |
| 56 | + | |
| 57 | - | end) |
| 57 | + | |
| 58 | - | Event.Parent = NLS([==[ |
| 58 | + | |
| 59 | - | local Player = game:GetService("Players").LocalPlayer
|
| 59 | + | |
| 60 | - | local Event = script:WaitForChild("UserInput_Event")
|
| 60 | + | |
| 61 | - | |
| 61 | + | |
| 62 | - | local UIS = game:GetService("UserInputService")
|
| 62 | + | |
| 63 | - | local input = function(io,a) |
| 63 | + | |
| 64 | - | if a then return end |
| 64 | + | |
| 65 | - | --Since InputObject is a client-side instance, we create and pass table instead |
| 65 | + | |
| 66 | - | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
|
| 66 | + | |
| 67 | end | |
| 68 | - | UIS.InputBegan:Connect(input) |
| 68 | + | |
| 69 | - | UIS.InputEnded:Connect(input) |
| 69 | + | |
| 70 | - | |
| 70 | + | |
| 71 | - | local Mouse = Player:GetMouse() |
| 71 | + | mouse.Button1Up:connect(function() |
| 72 | - | local h,t |
| 72 | + | |
| 73 | - | --Give the server mouse data 30 times every second, but only if the values changed |
| 73 | + | |
| 74 | - | --If player is not moving their mouse, client won't fire events |
| 74 | + | |
| 75 | - | while wait(1/30) do |
| 75 | + | |
| 76 | - | if h~=Mouse.Hit or t~=Mouse.Target then |
| 76 | + | end) |