memberhero

Ghost

Jan 13th, 2019 (edited)
373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.05 KB | None | 0 0
  1. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  2. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  3. do
  4. print("FE Compatibility code by Mokiros")
  5. script.Parent = Player.Character
  6.  
  7. --RemoteEvent for communicating
  8. local Event = Instance.new("RemoteEvent")
  9. Event.Name = "UserInput_Event"
  10.  
  11. --Fake event to make stuff like Mouse.KeyDown work
  12. local function fakeEvent()
  13. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  14. t.connect = t.Connect
  15. return t
  16. end
  17.  
  18. --Creating fake input objects with fake variables
  19. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  20. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  21. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  22. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  23. end}
  24. --Merged 2 functions into one by checking amount of arguments
  25. CAS.UnbindAction = CAS.BindAction
  26.  
  27. --This function will trigger the events that have been :Connect()'ed
  28. local function te(self,ev,...)
  29. local t = m[ev]
  30. if t and t._fakeEvent and t.Function then
  31. t.Function(...)
  32. end
  33. end
  34. m.TrigEvent = te
  35. UIS.TrigEvent = te
  36.  
  37. Event.OnServerEvent:Connect(function(plr,io)
  38. if plr~=Player then return end
  39. if io.isMouse then
  40. m.Target = io.Target
  41. m.Hit = io.Hit
  42. else
  43. local b = io.UserInputState == Enum.UserInputState.Begin
  44. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  45. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  46. end
  47. for _,t in pairs(CAS.Actions) do
  48. for _,k in pairs(t.Keys) do
  49. if k==io.KeyCode then
  50. t.Function(t.Name,io.UserInputState,io)
  51. end
  52. end
  53. end
  54. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  55. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  56. end
  57. end)
  58. Event.Parent = NLS([==[
  59. local Player = game:GetService("Players").LocalPlayer
  60. local Event = script:WaitForChild("UserInput_Event")
  61.  
  62. local UIS = game:GetService("UserInputService")
  63. local input = function(io,a)
  64. if a then return end
  65. --Since InputObject is a client-side instance, we create and pass table instead
  66. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  67. end
  68. UIS.InputBegan:Connect(input)
  69. UIS.InputEnded:Connect(input)
  70.  
  71. local Mouse = Player:GetMouse()
  72. local h,t
  73. --Give the server mouse data 30 times every second, but only if the values changed
  74. --If player is not moving their mouse, client won't fire events
  75. while wait(1/30) do
  76. if h~=Mouse.Hit or t~=Mouse.Target then
  77. h,t=Mouse.Hit,Mouse.Target
  78. Event:FireServer({isMouse=true,Target=t,Hit=h})
  79. end
  80. end]==],Player.Character)
  81. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  82. end
  83. wait(0.2)
  84. plr = owner
  85.  
  86. part = nil
  87. bp = nil
  88. particles = nil
  89. function clerp(a,b,c,d)
  90. for i = 0,d,.01 do
  91. a.CFrame = CFrame.new(b:lerp(c,i))
  92. wait()
  93. end
  94. end
  95. function slerp(a2,b2,c2,d2)
  96. for i2 = 0,d2,.01 do
  97. a2.CFrame = CFrame.new(b2:lerp(c2,i2))
  98. wait()
  99. end
  100. end
  101. mouse.KeyDown:connect(function(key)
  102. if key == "e" and plr.Character.Parent == workspace then
  103. plr.Character.Parent = workspace.Camera
  104. plr.Character.Archivable = true
  105. Instance.new("ForceField",plr.Character).Visible = false
  106. for y,t in pairs(plr.Character:GetChildren()) do
  107. if t:IsA("Part") and t.Name ~= "HumanoidRootPart" then
  108. t.Transparency = 1
  109. if t.Name == "Head" and t:FindFirstChild("face") then
  110. t.face.Transparency = 1
  111. end
  112. elseif t:IsA("Accessory") and t:FindFirstChild("Handle") then
  113. t.Handle.Transparency = 1
  114. end
  115. end
  116. elseif key == "z" and plr.Character.Parent == workspace.Camera and part == nil then
  117. 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)
  118. elseif key == "x" and plr.Character.Parent == workspace.Camera and part == nil then
  119. if plr.Character.Torso.Anchored == true then
  120. for y,t in pairs(plr.Character:GetChildren()) do
  121. if t:IsA("Part") then
  122. t.Anchored = false
  123. end
  124. end
  125. else
  126. for y,t in pairs(plr.Character:GetChildren()) do
  127. if t:IsA("Part") then
  128. t.Anchored = true
  129. end
  130. end
  131. end
  132. elseif key == "c" and plr.Character.Parent == workspace.Camera and part ~= nil then
  133. local clone = part:Clone()
  134. clone.Parent = workspace
  135. clone.Anchored = false
  136. clone:ClearAllChildren()
  137. clone.CanCollide = true
  138. bp.Parent = clone
  139. particles.Parent = clone
  140. if part.Parent:FindFirstChildOfClass("Humanoid") then
  141. part.Parent:FindFirstChildOfClass("Humanoid").PlatformStand = false
  142. end
  143. part:Destroy()
  144. part = clone
  145. elseif key == "t" and plr.Character.Parent == workspace.Camera and part == nil then
  146. plr.Character.Parent = workspace
  147. plr.Character.Archivable = false
  148. plr.Character:FindFirstChildOfClass("ForceField"):Remove()
  149. for y,t in pairs(plr.Character:GetChildren()) do
  150. if t:IsA("Part") and t.Name ~= "HumanoidRootPart" then
  151. t.Transparency = 0
  152. if t.Name == "Head" and t:FindFirstChild("face") then
  153. t.face.Transparency = 0
  154. end
  155. elseif t:IsA("Accessory") and t:FindFirstChild("Handle") then
  156. t.Handle.Transparency = 0
  157. end
  158. end
  159. end
  160. end)
  161. mouse.Button1Down:connect(function()
  162. if plr.Character.Parent == workspace.Camera then
  163. if mouse ~= nil then
  164. if mouse.Target ~= nil then
  165. part = mouse.Target
  166. bp = Instance.new("BodyPosition",part)
  167. bp.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  168. bp.Position = part.Position
  169. particles = Instance.new("ParticleEmitter",part)
  170. particles.Color = ColorSequence.new(Color3.new(0,0,0))
  171. particles.Size = NumberSequence.new(1)
  172. particles.Texture = "rbxassetid://292289455"
  173. particles.VelocitySpread = 360
  174. particles.Speed = NumberRange.new(0)
  175. particles.RotSpeed = NumberRange.new(0)
  176. particles.Rotation = NumberRange.new(0)
  177. particles.Rate = 250
  178. particles.Lifetime = NumberRange.new(.2,.4)
  179. particles.Transparency = NumberSequence.new({NumberSequenceKeypoint.new(0,1,0),NumberSequenceKeypoint.new(.12,.688,0),NumberSequenceKeypoint.new(.891,.887,0),NumberSequenceKeypoint.new(1,1,0)})
  180. dwn = true
  181. end
  182. end
  183. while dwn == true do
  184. wait()
  185. bp.Position = mouse.hit.p
  186. if part then
  187. if part.Parent:FindFirstChildOfClass("Humanoid") then
  188. part.Parent:FindFirstChildOfClass("Humanoid").PlatformStand = true
  189. end
  190. end
  191. end
  192. end
  193. end)
  194. mouse.Button1Up:connect(function()
  195. dwn = false
  196. if part then if part.Parent:FindFirstChildOfClass("Humanoid") then part.Parent:FindFirstChildOfClass("Humanoid").PlatformStand = false end part = nil end
  197. if bp then bp:Destroy() end
  198. if particles then particles:Destroy() end
  199. end)
  200. touchCounter = 0
  201. while wait() do
  202. if plr.Character.Parent == workspace.Camera then
  203. local c = plr.Character:Clone()
  204. c:MakeJoints()
  205. for y,t in pairs(c:GetChildren()) do
  206. if t:IsA("Part") then
  207. t.CanCollide = false
  208. t.Anchored = true
  209. t.Transparency = .5
  210. t.TopSurface = "Smooth"
  211. t.BottomSurface = "Smooth"
  212. t.RightSurface = "Smooth"
  213. t.LeftSurface = "Smooth"
  214. t.FrontSurface = "Smooth"
  215. t.BackSurface = "Smooth"
  216. t.BrickColor = BrickColor.new("Really black")
  217. if t.Name == "Head" and t:FindFirstChild("face") then
  218. t.face:Remove()
  219. elseif t.Name == "Torso" and t:FindFirstChild("roblox") then
  220. t.roblox:Remove()
  221. elseif t.Name == "HumanoidRootPart" then
  222. t:Remove()
  223. end
  224. else
  225. t:Remove()
  226. end
  227. end
  228. c.Parent = workspace
  229. game.Debris:AddItem(c,.05)
  230. end
  231. end
Add Comment
Please, Sign In to add comment