Advertisement
ManOhMan

Untitled

Aug 11th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- This script has been converted to FE by iPxter
  2.  
  3.  
  4. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  5. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  6. do
  7. print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
  8. script.Parent = Player.Character
  9.  
  10. --RemoteEvent for communicating
  11. local Event = Instance.new("RemoteEvent")
  12. Event.Name = "UserInput_Event"
  13.  
  14. --Fake event to make stuff like Mouse.KeyDown work
  15. local function fakeEvent()
  16. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  17. t.connect = t.Connect
  18. return t
  19. end
  20.  
  21. --Creating fake input objects with fake variables
  22. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  23. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  24. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  25. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  26. end}
  27. --Merged 2 functions into one by checking amount of arguments
  28. CAS.UnbindAction = CAS.BindAction
  29.  
  30. --This function will trigger the events that have been :Connect()'ed
  31. local function te(self,ev,...)
  32. local t = m[ev]
  33. if t and t._fakeEvent and t.Function then
  34. t.Function(...)
  35. end
  36. end
  37. m.TrigEvent = te
  38. UIS.TrigEvent = te
  39.  
  40. Event.OnServerEvent:Connect(function(plr,io)
  41. if plr~=Player then return end
  42. if io.isMouse then
  43. m.Target = io.Target
  44. m.Hit = io.Hit
  45. else
  46. local b = io.UserInputState == Enum.UserInputState.Begin
  47. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  48. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  49. end
  50. for _,t in pairs(CAS.Actions) do
  51. for _,k in pairs(t.Keys) do
  52. if k==io.KeyCode then
  53. t.Function(t.Name,io.UserInputState,io)
  54. end
  55. end
  56. end
  57. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  58. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  59. end
  60. end)
  61. Event.Parent = NLS([==[
  62. local Player = game:GetService("Players").LocalPlayer
  63. local Event = script:WaitForChild("UserInput_Event")
  64.  
  65. local UIS = game:GetService("UserInputService")
  66. local input = function(io,a)
  67. if a then return end
  68. --Since InputObject is a client-side instance, we create and pass table instead
  69. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  70. end
  71. UIS.InputBegan:Connect(input)
  72. UIS.InputEnded:Connect(input)
  73.  
  74. local Mouse = Player:GetMouse()
  75. local h,t
  76. --Give the server mouse data 30 times every second, but only if the values changed
  77. --If player is not moving their mouse, client won't fire events
  78. while wait(1/30) do
  79. if h~=Mouse.Hit or t~=Mouse.Target then
  80. h,t=Mouse.Hit,Mouse.Target
  81. Event:FireServer({isMouse=true,Target=t,Hit=h})
  82. end
  83. end]==],Player.Character)
  84. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  85. end
  86. --Script by Rufus14, Companion Cube model by Natej89
  87. gun = Instance.new("Part", owner.Character)
  88. gun.Size = Vector3.new(0.5, 1, 2)
  89. gun.CanCollide = false
  90. gun:BreakJoints()
  91. weld = Instance.new("Weld", gun)
  92. weld.Part0 = owner.Character["Right Arm"]
  93. weld.Part1 = gun
  94. mesh = Instance.new("SpecialMesh", gun)
  95. mesh.MeshId = "rbxassetid://430056568"
  96. mesh.TextureId = "rbxassetid://430056584"
  97. portalmoosic = Instance.new("Sound", owner.Character)
  98. portalmoosic.SoundId = "rbxassetid://142300248"
  99. portalmoosic.Looped = true
  100. portalmoosic:Play()
  101. impact = Instance.new("Sound", owner.Character)
  102. impact.SoundId = "rbxassetid://142082170"
  103. mesh.Scale = Vector3.new(0.17,0.17,0.17)
  104. weld.C0 = weld.C0 * CFrame.new(-0.2,-1.3,-0.8) * CFrame.Angles(3,0,0)
  105. local rhandweld = Instance.new("Weld", owner.Character.Torso)
  106. rhandweld.Part0 = owner.Character.Torso
  107. rhandweld.Part1 = owner.Character["Right Arm"]
  108. rhandweld.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  109. rhandweld.C1 = CFrame.new(0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  110. local lhandweld = Instance.new("Weld", owner.Character.Torso)
  111. lhandweld.Part0 = owner.Character.Torso
  112. lhandweld.Part1 = owner.Character["Left Arm"]
  113. lhandweld.C0 = CFrame.new(-1.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  114. lhandweld.C1 = CFrame.new(0, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  115. Pick = Instance.new("Sound", gun)
  116. Pick.SoundId = "rbxassetid://291256829"
  117. Pick:Play()
  118. blueexists = false
  119. tping = false
  120. orangeexists = false
  121. for i = 0,1 , 0.1 do
  122. wait()
  123. lhandweld.C0 = lhandweld.C0 * CFrame.new():lerp(CFrame.Angles(0,-0.2,-0.28),i)
  124. rhandweld.C0 = rhandweld.C0 * CFrame.new():lerp(CFrame.Angles(0,0,0.28),i)
  125. end
  126. for i = 0,1 , 0.1 do
  127. wait()
  128. lhandweld.C0 = lhandweld.C0 * CFrame.new():lerp(CFrame.new(0,-0.25,0),i)
  129. end
  130. using = false
  131. orange = false
  132. blue = true
  133. function changeportals(key)
  134. key = key:lower()
  135. if key == "q" then
  136. if not blue then
  137. blue = true
  138. orange = false
  139. end
  140. end
  141. if key == "e" then
  142. if not orange then
  143. blue = false
  144. orange = true
  145. end
  146. end
  147. end
  148. function portal()
  149. if not using then
  150. using = true
  151. if blue then
  152. local projectile = Instance.new("Part", workspace)
  153. projectile.Size = Vector3.new(1,1,1)
  154. projectile.BrickColor = BrickColor.new("Electric blue")
  155. projectile.Shape = "Ball"
  156. projectile.CanCollide = true
  157. projectile.Anchored = false
  158. projectile.Material = "Neon"
  159. local vel = Instance.new("BodyVelocity", projectile)
  160. vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  161. vel.Velocity = mouse.Hit.lookVector * 80
  162. projectile.Position = gun.CFrame.p
  163. wait(0.03)
  164. local function make(part)
  165. local gr = part.Parent:findFirstChild("Part")
  166. local portaldoor = Instance.new("Part", workspace)
  167. portaldoor.Size = Vector3.new(6.09, 5.84, 5.93)
  168. portaldoor.BrickColor = BrickColor.new("Electric blue")
  169. portaldoor.Anchored = true
  170. portaldoor.Shape = "Ball"
  171. portaldoor.Material = "Neon"
  172. portaldoor.CanCollide = false
  173. if blueexists == true then
  174. workspace.BluePortal:destroy()
  175. end
  176. blueexists = true
  177. portaldoor.Name = "BluePortal"
  178. portaldoor.CFrame = projectile.CFrame
  179. projectile:destroy()
  180. local function tp(part)
  181. local hum = part.Parent:findFirstChild("Humanoid")
  182. if hum ~= nil and blueexists and orangeexists and not tping then
  183. tping = true
  184. local tor = part.Parent:findFirstChild("Torso")
  185. if tor ~= nil then
  186. tor.CFrame = workspace.OrangePortal.CFrame
  187. end
  188. wait(0.1)
  189. tping = false
  190. end
  191. if not hum and blueexists and orangeexists and not tping then
  192. tping = true
  193. local cube = part.Parent:findFirstChild("Cube")
  194. if cube then
  195. tping = true
  196. cube.CFrame = workspace.OrangePortal.CFrame
  197. wait(0.1)
  198. tping = false
  199. end
  200. end
  201. end
  202. portaldoor.Touched:connect(tp)
  203. end
  204. projectile.Touched:connect(make)
  205. end
  206. if orange then
  207. local projectile1 = Instance.new("Part", workspace)
  208. projectile1.Size = Vector3.new(1,1,1)
  209. projectile1.BrickColor = BrickColor.new("Deep orange")
  210. projectile1.Shape = "Ball"
  211. projectile1.CanCollide = true
  212. projectile1.Anchored = false
  213. projectile1.Material = "Neon"
  214. local vel1 = Instance.new("BodyVelocity", projectile1)
  215. vel1.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  216. vel1.Velocity = mouse.Hit.lookVector * 80
  217. projectile1.Position = gun.CFrame.p
  218. wait(0.03)
  219. local function make1(part)
  220. local gr = part.Parent:findFirstChild("Part")
  221. local portaldoor = Instance.new("Part", workspace)
  222. portaldoor.Size = Vector3.new(6.09, 5.84, 5.93)
  223. portaldoor.BrickColor = BrickColor.new("Deep orange")
  224. portaldoor.Anchored = true
  225. portaldoor.Material = "Neon"
  226. portaldoor.Shape = "Ball"
  227. portaldoor.CanCollide = false
  228. if orangeexists == true then
  229. workspace.OrangePortal:destroy()
  230. end
  231. orangeexists = true
  232. portaldoor.Name = "OrangePortal"
  233. portaldoor.CFrame = projectile1.CFrame
  234. projectile1:destroy()
  235. local function tp(part)
  236. local hum = part.Parent:findFirstChild("Humanoid")
  237. if hum ~= nil and blueexists and orangeexists and not tping then
  238. tping = true
  239. local tor = part.Parent:findFirstChild("Torso")
  240. if tor ~= nil then
  241. tor.CFrame = workspace.BluePortal.CFrame
  242. end
  243. wait(0.1)
  244. tping = false
  245. end
  246. if not hum and blueexists and orangeexists and not tping then
  247. tping = true
  248. local cube = part.Parent:findFirstChild("Cube")
  249. if cube then
  250. tping = true
  251. cube.CFrame = workspace.BluePortal.CFrame
  252. wait(0.1)
  253. tping = false
  254. end
  255. end
  256. end
  257. portaldoor.Touched:connect(tp)
  258. end
  259. projectile1.Touched:connect(make1)
  260. end
  261.  
  262. for i = 0,1 , 0.3 do
  263. wait()
  264. lhandweld.C0 = lhandweld.C0 * CFrame.new():lerp(CFrame.Angles(0,0,-0.2),i)
  265. rhandweld.C0 = rhandweld.C0 * CFrame.new():lerp(CFrame.Angles(0,0,0.2),i)
  266. end
  267. for i = 0,1 , 0.3 do
  268. wait()
  269. lhandweld.C0 = lhandweld.C0 * CFrame.new():lerp(CFrame.Angles(0,0,0.2),i)
  270. rhandweld.C0 = rhandweld.C0 * CFrame.new():lerp(CFrame.Angles(0,0,-0.2),i)
  271. end
  272. using = false
  273. end
  274. end
  275. function remove(key)
  276. key = key:lower()
  277. if key == "r" then
  278. if blueexists or orangeexists or blueexists and orangeexists then
  279. workspace.OrangePortal:destroy()
  280. workspace.BluePortal:destroy()
  281. orangeexists = false
  282. blueexists = false
  283. end
  284. end
  285. end
  286. impacting = false
  287. cubesp = false
  288. function cubespawn(key)
  289. key = key:lower()
  290. if key == "c" then
  291. if cubesp then
  292. workspace.Cube:destroy()
  293. end
  294. cubesp = true
  295. local coobe = Instance.new("Part", workspace)
  296. coobe.Size = Vector3.new(2.774, 2.834, 2.804)
  297. coobe:BreakJoints()
  298. coobe.Position = owner.Character.Torso.Position
  299. coobe.Name = "Cube"
  300. local meh = Instance.new("SpecialMesh", coobe)
  301. meh.MeshId = "rbxassetid://464957313"
  302. meh.TextureId = "rbxassetid://464957325"
  303. meh.Scale = Vector3.new(0.8,0.8,0.8)
  304. local function sounds()
  305. if not impacting then
  306. impacting = true
  307. local impactspeed = math.random(0.9,1.1)
  308. impact.PlaybackSpeed = impactspeed
  309. impact:Play()
  310. wait(0.2)
  311. impacting = false
  312. end
  313. end
  314. coobe.Touched:connect(sounds)
  315. end
  316. end
  317. function deleterportalsondedth()
  318. if orangeexists or blueexists or blueexists and orangeexists then
  319. workspace.OrangePortal:destroy()
  320. workspace.BluePortal:destroy()
  321. if cubesp then
  322. workspace.Cube:destroy()
  323. end
  324. end
  325. end
  326. owner.Character.Humanoid.Died:connect(deleterportalsondedth)
  327. mouse.KeyDown:connect(cubespawn)
  328. mouse.Button1Down:connect(portal)
  329. mouse.KeyDown:connect(changeportals)
  330. mouse.KeyDown:connect(remove)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement