DrakerMaker

MY FE Converter

Sep 1st, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. if game:GetService("RunService"):IsClient() then error("Please run this as h/ or r/.") end
  2. local Player = owner
  3. print("Translated to FE / Created by DrakerMaker")
  4. local Mouse,mouse,UserInputService,ContextActionService
  5. do
  6. script.Parent = Player.Character
  7. local CAS = {Action={}}
  8. local Event = Instance.new("RemoteEvent")
  9. Event.Name = "UserInput_Event"
  10. local fakeEvent = function()
  11. local t = {_fakeEvent=true}
  12. t.Connect = function(self,f)self.Function = f end
  13. t.connect = t.Connect
  14. return t
  15. end
  16. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  17. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  18. function CAS:BindAction(name,fun,touch,...)
  19. CAS.Actions[name] = {Name=name,Function=fun,Keys={...}}
  20. end
  21. function CAS:UnbindAction(name)
  22. CAS.Actions[name] = nil
  23. end
  24. local function te(self,ev,...)
  25. local t = m[ev]
  26. if t and t._fakeEvent and t.Function then
  27. t.Function(...)
  28. end
  29. end
  30. m.TrigEvent = te
  31. UIS.TrigEvent = te
  32. Event.OnServerEvent:Connect(function(plr,io)
  33. if plr~=Player then return end
  34. if io.IsMouse then
  35. m.Target = io.Target
  36. m.Hit = io.Hit
  37. elseif io.UserInputType == Enum.UserInputType.Button1Down then
  38. if io.UserInputState == Enum.UserInputState.Begin then
  39. m:TrigEvent("Button1Down")
  40. else
  41. m:TrigEvent("Button1Up")
  42. end
  43. end
  44. else
  45. for n,t in pairs(CAS.Actions) do
  46. for _,k in pairs(t.Keys) do
  47. if k==io.KeyCode then
  48. t.Function(t.Name,io.UserInputState,io)
  49. end
  50. end
  51. end
  52. if io.UserInputState == Enum.UserInputState.Begin then
  53. m:TrigEvent("KeyDown",io.KeyCode.Name:lower())
  54. UIS:TrigEvent("InputBegan",io.KeyCode.Name:lower())
  55. else
  56. m:TrigEvent("KeyUp",io.KeyCode.Name:lower())
  57. UIS:TrigEvent("InputEnded",io.KeyCode.Name:lower())
  58. end
  59. end
  60. end)
  61. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  62. end
Add Comment
Please, Sign In to add comment