Advertisement
Animescapetower

Server Wide FE Converter

Nov 21st, 2018
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.15 KB | None | 0 0
  1. -- This script has been converted to FE by iPxter
  2. -- And edited by animescapetower
  3.  
  4.  
  5. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  6. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  7. do
  8. print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
  9. script.Parent = Player.Character
  10.  
  11. --RemoteEvent for communicating
  12. local Event= Instance.new("RemoteEvent")
  13. Event.Name = "UserInput_Event"
  14.  
  15. --Fake event to make stuff like Mouse.KeyDown work
  16. local function fakeEvent()
  17. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  18. t.connect = t.Connect
  19. return t
  20. end
  21.  
  22. --Creating fake input objects with fake variables
  23. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  24. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  25. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  26. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  27. end}
  28. --Merged 2 functions into one by checking amount of arguments
  29. CAS.UnbindAction = CAS.BindAction
  30.  
  31. --This function will trigger the events that have been :Connect()'ed
  32. local function te(self,ev,...)
  33. local t = m[ev]
  34. if t and t._fakeEvent and t.Function then
  35. t.Function(...)
  36. end
  37. end
  38. m.TrigEvent = te
  39. UIS.TrigEvent = te
  40.  
  41. Event.OnServerEvent:Connect(function(plr,io)
  42. if plr~=Player then return end
  43. if io.isMouse then
  44. m.Target = io.Target
  45. m.Hit = io.Hit
  46. else
  47. local b = io.UserInputState == Enum.UserInputState.Begin
  48. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  49. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  50. end
  51. for _,t in pairs(CAS.Actions) do
  52. for _,k in pairs(t.Keys) do
  53. if k==io.KeyCode then
  54. t.Function(t.Name,io.UserInputState,io)
  55. end
  56. end
  57. end
  58. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  59. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  60. end
  61. end)
  62. Event.Parent = NLS([==[
  63. local Player = game:GetService("Players").LocalPlayer
  64. local Event = script:WaitForChild("UserInput_Event")
  65.  
  66. local UIS = game:GetService("UserInputService")
  67. local input = function(io,a)
  68. if a then return end
  69. --Since InputObject is a client-side instance, we create and pass table instead
  70. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  71. end
  72. UIS.InputBegan:Connect(input)
  73. UIS.InputEnded:Connect(input)
  74.  
  75. local Mouse = Player:GetMouse()
  76. local h,t
  77. --Give the server mouse data 30 times every second, but only if the values changed
  78. --If player is not moving their mouse, client won't fire events
  79. while wait(1/30) do
  80. if h~=Mouse.Hit or t~=Mouse.Target then
  81. h,t=Mouse.Hit,Mouse.Target
  82. Event:FireServer({isMouse=true,Target=t,Hit=h})
  83. end
  84. end]==],Player.Character)
  85. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  86. end
  87.  
  88.  
  89. _G.owner,player,playe,play,pla,pl,p = owner
  90. _G.mouse = mouse
  91. _G.Mouse = Mouse
  92. _G.UserInputService = UserInputService
  93. _G.ContextActionService = ContextActionService
  94.  
  95.  
  96. _G.Metatype = function(table_)
  97.  
  98. for _,t in ipairs(table_) do
  99. local tables,tab,t = t,t,t
  100. print(type(tables))
  101. print(t)
  102. end
  103.  
  104. return table_
  105. end
  106.  
  107. _G.CreateSound = function(id,vol,pitch)
  108. sound1 = Instance.new("Sound")
  109. sound1.Volume = vol
  110. sound1.PlaybackSpeed = pitch
  111. sound1.SoundId = "rbxassetid://"..id
  112. sound1.Parent = workspace
  113. sound1:Play()
  114. wait(sound1.TimeLength)
  115. sound1:Destroy()
  116. end
  117.  
  118. _G.Destroy = function(object)
  119. if object ~= nil then
  120. object:Destroy()
  121. end
  122. end
  123.  
  124. _G.Unlock = function(object)
  125. if object ~= nil then
  126. object.Locked = false
  127. end
  128. end
  129.  
  130. _G.UnlockAll = function()
  131. while wait() do
  132. for _,n in ipairs(workspace:GetChildren()) do
  133. if n.ClassName == "Part" or n.ClassName == "MeshPart" then
  134. n.Locked = false
  135. end
  136. end
  137. for _,n3 in ipairs(workspace:GetChildren()) do
  138. if n3.ClassName == "Model" then
  139. for _,n2 in ipairs(n3:GetChildren()) do
  140. if n2.ClassName == "Part" or n2.ClassName == "MeshPart" then
  141. n2.Locked = false
  142. end
  143. end
  144. end
  145. for _,n4 in ipairs(n3:GetChildren()) do
  146. if n4.ClassName == "Model" then
  147. for _,n5 in ipairs(n4:GetChildren()) do
  148. if n5.ClassName == "Part" or n5.ClassName == "MeshPart" then
  149. n5.Locked = false
  150. end
  151. end
  152. end
  153. end
  154.  
  155. end
  156. end
  157. end
  158.  
  159. _G.DestroyAll = function()
  160. for _,n in ipairs(workspace:GetChildren()) do
  161. if n.ClassName == "Part" or n.ClassName == "MeshPart" then
  162. n:Destroy()
  163. end
  164. end
  165. for _,n3 in ipairs(workspace:GetChildren()) do
  166. if n3.ClassName == "Model" then
  167. for _,n2 in ipairs(n3:GetChildren()) do
  168. if n2.ClassName == "Part" or n2.ClassName == "MeshPart" then
  169. n2:Destroy()
  170. end
  171. end
  172. end
  173. for _,n4 in ipairs(n3:GetChildren()) do
  174. if n4.ClassName == "Model" then
  175. for _,n5 in ipairs(n4:GetChildren()) do
  176. if n5.ClassName == "Part" or n5.ClassName == "MeshPart" then
  177. n5:Destroy()
  178. end
  179. end
  180. end
  181. end
  182.  
  183. end
  184. end
  185.  
  186. e,e2 =workspace:WaitForChild("Base"), workspace:WaitForChild("Baseplate")
  187.  
  188. k = workspace:GetChildren()
  189.  
  190. _G.k = k
  191. _G.e = e
  192. _G.e2 = e
  193. clonedtables = {}
  194. _G.clonestables = clonedtables
  195.  
  196. for _, k2 in ipairs(k) do
  197. if k2.ClassName == "Part" or k2.ClassName == "MeshPart" or k2.ClassName == "UnionOperation" then
  198. l = k:Clone()
  199.  
  200. table.insert(clonedtables,k)
  201.  
  202. end
  203. end
  204.  
  205. while wait(.1) do
  206.  
  207. for _,c in ipairs(clonedtables) do
  208. e254 = c:Clone()
  209. e254.Parent = workspace
  210. wait(0.1)
  211. e254:Destroy()
  212. end
  213.  
  214. end
  215.  
  216.  
  217.  
  218.  
  219.  
  220. -- [[
  221. --
  222. --so uh any player prefixes in scripts or this [game.Players.LocalPlayer] or this [game:GetService("Players").LocalPlayer] should be ---renamed to owner and also don't forget the mouses to so change player:GetMouse() to mouse or Mouse if you need to.
  223. --
  224. --To note : I however did not make this ask mokiros and you can see on the 2 lines of text 1 line : This script has been converted to --FE by iPxter : 2nd line : And edited by animescapetower to work on all scripts, ok bye
  225. --
  226. --
  227. --]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement