Robloxian_Scripter

Untitled

Mar 26th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. me = owner
  90. hoppa = Instance.new("HopperBin")
  91. hoppa.Parent = me.Backpack
  92. hoppa.Name = "Steal"
  93. script.Parent = hoppa
  94. function selected(mouse, key)
  95. mouse.Button1Down:connect(function()
  96. if mouse.Target then
  97. local targ = mouse.Target
  98. if targ.Name == "Base" then return end
  99. local too = Instance.new("Tool")
  100. too.Parent = me.Backpack
  101. too.Name = targ.Name
  102. too.GripPos = Vector3.new(0,0,0)
  103. if targ.Size.Y >= 1 then
  104. too.GripPos = Vector3.new(0,-0.5,0)
  105. elseif targ.Size.Y >= 2 then
  106. too.GripPos = Vector3.new(0,-1,0)
  107. elseif targ.Size.Y >= 3 then
  108. too.GripPos = Vector3.new(0,-1.5,0)
  109. elseif targ.Size.Y >= 4 then
  110. too.GripPos = Vector3.new(0,-2,0)
  111. end
  112. local hand = targ
  113. hand.Name = "Handle"
  114. hand.Anchored = false
  115. hand.Parent = too
  116. hand.CanCollide = false
  117. local gee = false
  118. local function touch(hit)
  119. if gee == false then return end
  120. local hum = hit.Parent:findFirstChild("Humanoid")
  121. if hum ~= nil then
  122. hum:TakeDamage(math.random(5,10))
  123. end
  124. end
  125. hand.Touched:connect(touch)
  126. too.Equipped:connect(function()
  127. too.Activated:connect(function()
  128. gee = true
  129. local val = Instance.new("StringValue")
  130. val.Parent = too
  131. val.Name = "toolanim"
  132. val.Value = "Slash"
  133. wait(0.5)
  134. gee = false
  135. end)
  136. end)
  137. end
  138. end)
  139. end
  140.  
  141. script.Parent.Selected:connect(selected)
Add Comment
Please, Sign In to add comment