Advertisement
Robloxian_Scripter

Untitled

Mar 26th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.42 KB | None | 0 0
  1.  
  2. -- This script has been converted to FE by iPxter
  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. ---------------------------
  90. --Created by DJwaffle2005--
  91. ---------------------------
  92. wait(0.1)
  93.  
  94. player = owner
  95. workspacePlayer = owner
  96.  
  97. local ff = Instance.new("ForceField") --Creates forcefield
  98. ff.Parent = workspacePlayer
  99.  
  100. workspacePlayer.Humanoid.WalkSpeed = 30
  101.  
  102. local tool1 = Instance.new("HopperBin") --Gives the player a grab tool.
  103. tool1.Name = "Grab"
  104. tool1.Parent = player.Backpack
  105. tool1.BinType = "Grab"
  106. print("Gave grab tool")
  107.  
  108. local tool2 = Instance.new("HopperBin") --Gives the player a clone tool.
  109. tool2.Name = "Clone"
  110. tool2.Parent = player.Backpack
  111. tool2.BinType = "Clone"
  112. print("Gave clone tool")
  113.  
  114. local tool3 = Instance.new("HopperBin") --Gives the player a destroy tool.
  115. tool3.Name = "Hammer"
  116. tool3.Parent = player.Backpack
  117. tool3.BinType = "Hammer"
  118. print("Gave delete tool")
  119.  
  120. local tool4 = Instance.new("HopperBin") --Gives the player a tool where it spawns a part.
  121. tool4.Name = "New Part"
  122. tool4.Parent = player.Backpack
  123. tool4.BinType = "Script"
  124. print("Gave new part tool")
  125.  
  126. local tool5 = Instance.new("HopperBin") --Gives the player a tool where it spawns a part.
  127. tool5.Name = "Paint"
  128. tool5.Parent = player.Backpack
  129. tool5.BinType = "Script"
  130. print("Gave paint tool")
  131.  
  132. local tool6 = Instance.new("HopperBin") --Gives the player a tool where it spawns a part.
  133. tool6.Name = "Anchor"
  134. tool6.Parent = player.Backpack
  135. tool6.BinType = "Script"
  136. print("Gave anchor tool")
  137.  
  138. local tool7 = Instance.new("HopperBin") --Gives the player a tool where it spawns a part.
  139. tool7.Name = "Un-Anchor"
  140. tool7.Parent = player.Backpack
  141. tool7.BinType = "Script"
  142. print("Gave un-anchor tool")
  143.  
  144. local tool8 = Instance.new("HopperBin") --Gives the player a tool where it spawns a part.
  145. tool8.Name = "Lock"
  146. tool8.Parent = player.Backpack
  147. tool8.BinType = "Script"
  148. print("Gave lock tool")
  149.  
  150. local tool9 = Instance.new("HopperBin") --Gives the player a tool where it spawns a part.
  151. tool9.Name = "Unlock"
  152. tool9.Parent = player.Backpack
  153. tool9.BinType = "Script"
  154. print("Gave unlock tool")
  155.  
  156. playerMouse = owner
  157.  
  158.  
  159. --Functions--
  160. function lock()
  161. playerMouse.Target.Locked = true
  162. print("Locked "..playerMouse.Target.Name)
  163. end
  164.  
  165. function unlock()
  166. playerMouse.Target.Locked = false
  167. print("Unlocked "..playerMouse.Target.Name)
  168. end
  169.  
  170. function anchor()
  171. playerMouse.Target.Anchored = true
  172. print("Anchored "..playerMouse.Target.Name)
  173. end
  174.  
  175. function unanchor()
  176. playerMouse.Target.Anchored = false
  177. print("Un-anchored "..playerMouse.Target.Name)
  178. end
  179.  
  180. function paint()
  181. playerMouse.Target.BrickColor = BrickColor.Random()
  182. end
  183.  
  184. function create(mouse)
  185. local part = Instance.new("Part")
  186. part.Parent = game.Workspace
  187. part.Position = player.Head.Position
  188. part.Anchored = true
  189. part.Locked = false
  190. print("Created a new part.")
  191. end
  192.  
  193. ------------------------
  194.  
  195. --Events-
  196.  
  197. tool4.Selected:connect(function(mouse)
  198. print("Selected.")
  199. mouse.Button1Down:connect(create)
  200. end)
  201.  
  202. tool5.Selected:connect(function(mouse)
  203. print("Selected.")
  204. mouse.Button1Down:connect(paint)
  205. end)
  206.  
  207. tool6.Selected:connect(function(mouse)
  208. print("Selected.")
  209. mouse.Button1Down:connect(anchor)
  210. end)
  211.  
  212. tool7.Selected:connect(function(mouse)
  213. print("Selected.")
  214. mouse.Button1Down:connect(unanchor)
  215. end)
  216.  
  217. tool8.Selected:connect(function(mouse)
  218. print("Selected.")
  219. mouse.Button1Down:connect(lock)
  220. end)
  221.  
  222. tool9.Selected:connect(function(mouse)
  223. print("Selected.")
  224. mouse.Button1Down:connect(unlock)
  225. end)
  226.  
  227. print("Gave tools to "..player.Name..".")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement