Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --https://github.com/Mokiros/roblox-FE-compatibility
- if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
- local Player,Mouse,mouse,UserInputService,ContextActionService = owner
- local RealPlayer = Player
- do print("FE Compatibility code by Mokiros")local a=RealPlayer;script.Parent=a.Character;local b=Instance.new("RemoteEvent")b.Name="UserInput_Event"local function c()local d={_fakeEvent=true,Functions={},Connect=function(self,e)table.insert(self.Functions,e)end}d.connect=d.Connect;return d end;local f={Target=nil,Hit=CFrame.new(),KeyUp=c(),KeyDown=c(),Button1Up=c(),Button1Down=c(),Button2Up=c(),Button2Down=c()}local g={InputBegan=c(),InputEnded=c()}local CAS={Actions={},BindAction=function(self,h,i,j,...)CAS.Actions[h]=i and{Name=h,Function=i,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function k(self,l,...)local d=f[l]if d and d._fakeEvent then for m,e in pairs(d.Functions)do e(...)end end end;f.TrigEvent=k;g.TrigEvent=k;b.OnServerEvent:Connect(function(n,o)if n~=a then return end;f.Target=o.Target;f.Hit=o.Hit;if not o.isMouse then local p=o.UserInputState==Enum.UserInputState.Begin;if o.UserInputType==Enum.UserInputType.MouseButton1 then return f:TrigEvent(p and"Button1Down"or"Button1Up")end;if o.UserInputType==Enum.UserInputType.MouseButton2 then return f:TrigEvent(p and"Button2Down"or"Button2Up")end;for m,d in pairs(CAS.Actions)do for m,q in pairs(d.Keys)do if q==o.KeyCode then d.Function(d.Name,o.UserInputState,o)end end end;f:TrigEvent(p and"KeyDown"or"KeyUp",o.KeyCode.Name:lower())g:TrigEvent(p and"InputBegan"or"InputEnded",o,false)end end)b.Parent=NLS([==[local a=game:GetService("Players").LocalPlayer;local b=script:WaitForChild("UserInput_Event")local c=a:GetMouse()local d=game:GetService("UserInputService")local e=function(f,g)if g then return end;b:FireServer({KeyCode=f.KeyCode,UserInputType=f.UserInputType,UserInputState=f.UserInputState,Hit=c.Hit,Target=c.Target})end;d.InputBegan:Connect(e)d.InputEnded:Connect(e)local h,i;while wait(1/30)do if h~=c.Hit or i~=c.Target then h,i=c.Hit,c.Target;b:FireServer({isMouse=true,Target=i,Hit=h})end end]==],Player.Character)local r=game;local s={__index=function(self,q)local t=rawget(self,"_RealService")if t then return typeof(t[q])=="function"and function(m,...)return t[q](t,...)end or t[q]end end,__newindex=function(self,q,u)local t=rawget(self,"_RealService")if t then t[q]=u end end}local function v(d,w)d._RealService=typeof(w)=="string"and r:GetService(w)or w;return setmetatable(d,s)end;local x={GetService=function(self,t)return rawget(self,t)or r:GetService(t)end,Players=v({LocalPlayer=v({GetMouse=function(self)return f end},Player)},"Players"),UserInputService=v(g,"UserInputService"),ContextActionService=v(CAS,"ContextActionService"),RunService=v({_btrs={},RenderStepped=r:GetService("RunService").Heartbeat,BindToRenderStep=function(self,h,m,i)self._btrs[h]=self.Heartbeat:Connect(i)end,UnbindFromRenderStep=function(self,h)self._btrs[h]:Disconnect()end},"RunService")}rawset(x.Players,"localPlayer",x.Players.LocalPlayer)x.service=x.GetService;v(x,game)game,owner=x,x.Players.LocalPlayer end --Script by Rufus14, Companion Cube model by Natej89
- mouse = game.Players.LocalPlayer:GetMouse()
- gun = Instance.new("Part", game.Players.LocalPlayer.Character)
- gun.Size = Vector3.new(0.5, 1, 2)
- gun.CanCollide = false
- gun:BreakJoints()
- weld = Instance.new("Weld", gun)
- weld.Part0 = game.Players.LocalPlayer.Character["Right Arm"]
- weld.Part1 = gun
- mesh = Instance.new("SpecialMesh", gun)
- mesh.MeshId = "rbxassetid://430056568"
- mesh.TextureId = "rbxassetid://430056584"
- portalmoosic = Instance.new("Sound", game.Players.LocalPlayer.Character)
- portalmoosic.SoundId = "rbxassetid://142300248"
- portalmoosic.Looped = true
- portalmoosic:Play()
- impact = Instance.new("Sound", game.Players.LocalPlayer.Character)
- impact.SoundId = "rbxassetid://142082170"
- mesh.Scale = Vector3.new(0.17,0.17,0.17)
- weld.C0 = weld.C0 * CFrame.new(-0.2,-1.3,-0.8) * CFrame.Angles(3,0,0)
- local rhandweld = Instance.new("Weld", game.Players.LocalPlayer.Character.Torso)
- rhandweld.Part0 = game.Players.LocalPlayer.Character.Torso
- rhandweld.Part1 = game.Players.LocalPlayer.Character["Right Arm"]
- rhandweld.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
- rhandweld.C1 = CFrame.new(0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
- local lhandweld = Instance.new("Weld", game.Players.LocalPlayer.Character.Torso)
- lhandweld.Part0 = game.Players.LocalPlayer.Character.Torso
- lhandweld.Part1 = game.Players.LocalPlayer.Character["Left Arm"]
- lhandweld.C0 = CFrame.new(-1.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- lhandweld.C1 = CFrame.new(0, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Pick = Instance.new("Sound", gun)
- Pick.SoundId = "rbxassetid://291256829"
- Pick:Play()
- blueexists = false
- tping = false
- orangeexists = false
- for i = 0,1 , 0.1 do
- wait()
- lhandweld.C0 = lhandweld.C0 * CFrame.new():lerp(CFrame.Angles(0,-0.2,-0.28),i)
- rhandweld.C0 = rhandweld.C0 * CFrame.new():lerp(CFrame.Angles(0,0,0.28),i)
- end
- for i = 0,1 , 0.1 do
- wait()
- lhandweld.C0 = lhandweld.C0 * CFrame.new():lerp(CFrame.new(0,-0.25,0),i)
- end
- using = false
- orange = false
- blue = true
- function changeportals(key)
- key = key:lower()
- if key == "q" then
- if not blue then
- blue = true
- orange = false
- end
- end
- if key == "e" then
- if not orange then
- blue = false
- orange = true
- end
- end
- end
- function portal()
- if not using then
- using = true
- if blue then
- local projectile = Instance.new("Part", workspace)
- projectile.Size = Vector3.new(1,1,1)
- projectile.BrickColor = BrickColor.new("Electric blue")
- projectile.Shape = "Ball"
- projectile.CanCollide = true
- projectile.Anchored = false
- projectile.Material = "Neon"
- local vel = Instance.new("BodyVelocity", projectile)
- vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
- vel.Velocity = mouse.Hit.lookVector * 80
- projectile.Position = gun.CFrame.p
- wait(0.03)
- local function make(part)
- local gr = part.Parent:findFirstChild("Part")
- local portaldoor = Instance.new("Part", workspace)
- portaldoor.Size = Vector3.new(6.09, 5.84, 5.93)
- portaldoor.BrickColor = BrickColor.new("Electric blue")
- portaldoor.Anchored = true
- portaldoor.Shape = "Ball"
- portaldoor.Material = "Neon"
- portaldoor.CanCollide = false
- if blueexists == true then
- workspace.BluePortal:destroy()
- end
- blueexists = true
- portaldoor.Name = "BluePortal"
- portaldoor.CFrame = projectile.CFrame
- projectile:destroy()
- local function tp(part)
- local hum = part.Parent:findFirstChild("Humanoid")
- if hum ~= nil and blueexists and orangeexists and not tping then
- tping = true
- local tor = part.Parent:findFirstChild("Torso")
- if tor ~= nil then
- tor.CFrame = workspace.OrangePortal.CFrame
- end
- wait(0.1)
- tping = false
- end
- if not hum and blueexists and orangeexists and not tping then
- tping = true
- local cube = part.Parent:findFirstChild("Cube")
- if cube then
- tping = true
- cube.CFrame = workspace.OrangePortal.CFrame
- wait(0.1)
- tping = false
- end
- end
- end
- portaldoor.Touched:connect(tp)
- end
- projectile.Touched:connect(make)
- end
- if orange then
- local projectile1 = Instance.new("Part", workspace)
- projectile1.Size = Vector3.new(1,1,1)
- projectile1.BrickColor = BrickColor.new("Deep orange")
- projectile1.Shape = "Ball"
- projectile1.CanCollide = true
- projectile1.Anchored = false
- projectile1.Material = "Neon"
- local vel1 = Instance.new("BodyVelocity", projectile1)
- vel1.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
- vel1.Velocity = mouse.Hit.lookVector * 80
- projectile1.Position = gun.CFrame.p
- wait(0.03)
- local function make1(part)
- local gr = part.Parent:findFirstChild("Part")
- local portaldoor = Instance.new("Part", workspace)
- portaldoor.Size = Vector3.new(6.09, 5.84, 5.93)
- portaldoor.BrickColor = BrickColor.new("Deep orange")
- portaldoor.Anchored = true
- portaldoor.Material = "Neon"
- portaldoor.Shape = "Ball"
- portaldoor.CanCollide = false
- if orangeexists == true then
- workspace.OrangePortal:destroy()
- end
- orangeexists = true
- portaldoor.Name = "OrangePortal"
- portaldoor.CFrame = projectile1.CFrame
- projectile1:destroy()
- local function tp(part)
- local hum = part.Parent:findFirstChild("Humanoid")
- if hum ~= nil and blueexists and orangeexists and not tping then
- tping = true
- local tor = part.Parent:findFirstChild("Torso")
- if tor ~= nil then
- tor.CFrame = workspace.BluePortal.CFrame
- end
- wait(0.1)
- tping = false
- end
- if not hum and blueexists and orangeexists and not tping then
- tping = true
- local cube = part.Parent:findFirstChild("Cube")
- if cube then
- tping = true
- cube.CFrame = workspace.BluePortal.CFrame
- wait(0.1)
- tping = false
- end
- end
- end
- portaldoor.Touched:connect(tp)
- end
- projectile1.Touched:connect(make1)
- end
- for i = 0,1 , 0.3 do
- wait()
- lhandweld.C0 = lhandweld.C0 * CFrame.new():lerp(CFrame.Angles(0,0,-0.2),i)
- rhandweld.C0 = rhandweld.C0 * CFrame.new():lerp(CFrame.Angles(0,0,0.2),i)
- end
- for i = 0,1 , 0.3 do
- wait()
- lhandweld.C0 = lhandweld.C0 * CFrame.new():lerp(CFrame.Angles(0,0,0.2),i)
- rhandweld.C0 = rhandweld.C0 * CFrame.new():lerp(CFrame.Angles(0,0,-0.2),i)
- end
- using = false
- end
- end
- function remove(key)
- key = key:lower()
- if key == "r" then
- if blueexists or orangeexists or blueexists and orangeexists then
- workspace.OrangePortal:destroy()
- workspace.BluePortal:destroy()
- orangeexists = false
- blueexists = false
- end
- end
- end
- impacting = false
- cubesp = false
- function cubespawn(key)
- key = key:lower()
- if key == "c" then
- if cubesp then
- workspace.Cube:destroy()
- end
- cubesp = true
- local coobe = Instance.new("Part", workspace)
- coobe.Size = Vector3.new(2.774, 2.834, 2.804)
- coobe:BreakJoints()
- coobe.Position = game.Players.LocalPlayer.Character.Torso.Position
- coobe.Name = "Cube"
- local meh = Instance.new("SpecialMesh", coobe)
- meh.MeshId = "rbxassetid://464957313"
- meh.TextureId = "rbxassetid://464957325"
- meh.Scale = Vector3.new(0.8,0.8,0.8)
- local function sounds()
- if not impacting then
- impacting = true
- local impactspeed = math.random(0.9,1.1)
- impact.PlaybackSpeed = impactspeed
- impact:Play()
- wait(0.2)
- impacting = false
- end
- end
- coobe.Touched:connect(sounds)
- end
- end
- function deleterportalsondedth()
- if orangeexists or blueexists or blueexists and orangeexists then
- workspace.OrangePortal:destroy()
- workspace.BluePortal:destroy()
- if cubesp then
- workspace.Cube:destroy()
- end
- end
- end
- game.Players.LocalPlayer.Character.Humanoid.Died:connect(deleterportalsondedth)
- mouse.KeyDown:connect(cubespawn)
- mouse.Button1Down:connect(portal)
- mouse.KeyDown:connect(changeportals)
- mouse.KeyDown:connect(remove)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement