SHOW:
|
|
- or go back to the newest paste.
1 | - | --Script by Rufus14, Companion Cube model by Natej89 |
1 | + | --https://github.com/Mokiros/roblox-FE-compatibility |
2 | if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end | |
3 | local Player,Mouse,mouse,UserInputService,ContextActionService = owner | |
4 | local RealPlayer = Player | |
5 | 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 | |
6 | mouse = game.Players.LocalPlayer:GetMouse() | |
7 | gun = Instance.new("Part", game.Players.LocalPlayer.Character) | |
8 | gun.Size = Vector3.new(0.5, 1, 2) | |
9 | gun.CanCollide = false | |
10 | gun:BreakJoints() | |
11 | weld = Instance.new("Weld", gun) | |
12 | weld.Part0 = game.Players.LocalPlayer.Character["Right Arm"] | |
13 | weld.Part1 = gun | |
14 | mesh = Instance.new("SpecialMesh", gun) | |
15 | mesh.MeshId = "rbxassetid://430056568" | |
16 | mesh.TextureId = "rbxassetid://430056584" | |
17 | portalmoosic = Instance.new("Sound", game.Players.LocalPlayer.Character) | |
18 | portalmoosic.SoundId = "rbxassetid://142300248" | |
19 | portalmoosic.Looped = true | |
20 | portalmoosic:Play() | |
21 | impact = Instance.new("Sound", game.Players.LocalPlayer.Character) | |
22 | impact.SoundId = "rbxassetid://142082170" | |
23 | mesh.Scale = Vector3.new(0.17,0.17,0.17) | |
24 | weld.C0 = weld.C0 * CFrame.new(-0.2,-1.3,-0.8) * CFrame.Angles(3,0,0) | |
25 | local rhandweld = Instance.new("Weld", game.Players.LocalPlayer.Character.Torso) | |
26 | rhandweld.Part0 = game.Players.LocalPlayer.Character.Torso | |
27 | rhandweld.Part1 = game.Players.LocalPlayer.Character["Right Arm"] | |
28 | rhandweld.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0) | |
29 | rhandweld.C1 = CFrame.new(0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0) | |
30 | local lhandweld = Instance.new("Weld", game.Players.LocalPlayer.Character.Torso) | |
31 | lhandweld.Part0 = game.Players.LocalPlayer.Character.Torso | |
32 | lhandweld.Part1 = game.Players.LocalPlayer.Character["Left Arm"] | |
33 | lhandweld.C0 = CFrame.new(-1.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0) | |
34 | lhandweld.C1 = CFrame.new(0, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0) | |
35 | Pick = Instance.new("Sound", gun) | |
36 | Pick.SoundId = "rbxassetid://291256829" | |
37 | Pick:Play() | |
38 | blueexists = false | |
39 | tping = false | |
40 | orangeexists = false | |
41 | for i = 0,1 , 0.1 do | |
42 | wait() | |
43 | lhandweld.C0 = lhandweld.C0 * CFrame.new():lerp(CFrame.Angles(0,-0.2,-0.28),i) | |
44 | rhandweld.C0 = rhandweld.C0 * CFrame.new():lerp(CFrame.Angles(0,0,0.28),i) | |
45 | end | |
46 | for i = 0,1 , 0.1 do | |
47 | wait() | |
48 | lhandweld.C0 = lhandweld.C0 * CFrame.new():lerp(CFrame.new(0,-0.25,0),i) | |
49 | end | |
50 | using = false | |
51 | orange = false | |
52 | blue = true | |
53 | function changeportals(key) | |
54 | key = key:lower() | |
55 | if key == "q" then | |
56 | if not blue then | |
57 | blue = true | |
58 | orange = false | |
59 | end | |
60 | end | |
61 | if key == "e" then | |
62 | if not orange then | |
63 | blue = false | |
64 | orange = true | |
65 | end | |
66 | end | |
67 | end | |
68 | function portal() | |
69 | if not using then | |
70 | using = true | |
71 | if blue then | |
72 | local projectile = Instance.new("Part", workspace) | |
73 | projectile.Size = Vector3.new(1,1,1) | |
74 | projectile.BrickColor = BrickColor.new("Electric blue") | |
75 | projectile.Shape = "Ball" | |
76 | projectile.CanCollide = true | |
77 | projectile.Anchored = false | |
78 | projectile.Material = "Neon" | |
79 | local vel = Instance.new("BodyVelocity", projectile) | |
80 | vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge) | |
81 | vel.Velocity = mouse.Hit.lookVector * 80 | |
82 | projectile.Position = gun.CFrame.p | |
83 | wait(0.03) | |
84 | local function make(part) | |
85 | local gr = part.Parent:findFirstChild("Part") | |
86 | local portaldoor = Instance.new("Part", workspace) | |
87 | portaldoor.Size = Vector3.new(6.09, 5.84, 5.93) | |
88 | portaldoor.BrickColor = BrickColor.new("Electric blue") | |
89 | portaldoor.Anchored = true | |
90 | portaldoor.Shape = "Ball" | |
91 | portaldoor.Material = "Neon" | |
92 | portaldoor.CanCollide = false | |
93 | if blueexists == true then | |
94 | workspace.BluePortal:destroy() | |
95 | end | |
96 | blueexists = true | |
97 | portaldoor.Name = "BluePortal" | |
98 | portaldoor.CFrame = projectile.CFrame | |
99 | projectile:destroy() | |
100 | local function tp(part) | |
101 | local hum = part.Parent:findFirstChild("Humanoid") | |
102 | if hum ~= nil and blueexists and orangeexists and not tping then | |
103 | tping = true | |
104 | local tor = part.Parent:findFirstChild("Torso") | |
105 | if tor ~= nil then | |
106 | tor.CFrame = workspace.OrangePortal.CFrame | |
107 | end | |
108 | wait(0.1) | |
109 | tping = false | |
110 | end | |
111 | if not hum and blueexists and orangeexists and not tping then | |
112 | tping = true | |
113 | local cube = part.Parent:findFirstChild("Cube") | |
114 | if cube then | |
115 | tping = true | |
116 | cube.CFrame = workspace.OrangePortal.CFrame | |
117 | wait(0.1) | |
118 | tping = false | |
119 | end | |
120 | end | |
121 | end | |
122 | portaldoor.Touched:connect(tp) | |
123 | end | |
124 | projectile.Touched:connect(make) | |
125 | end | |
126 | if orange then | |
127 | local projectile1 = Instance.new("Part", workspace) | |
128 | projectile1.Size = Vector3.new(1,1,1) | |
129 | projectile1.BrickColor = BrickColor.new("Deep orange") | |
130 | projectile1.Shape = "Ball" | |
131 | projectile1.CanCollide = true | |
132 | projectile1.Anchored = false | |
133 | projectile1.Material = "Neon" | |
134 | local vel1 = Instance.new("BodyVelocity", projectile1) | |
135 | vel1.MaxForce = Vector3.new(math.huge,math.huge,math.huge) | |
136 | vel1.Velocity = mouse.Hit.lookVector * 80 | |
137 | projectile1.Position = gun.CFrame.p | |
138 | wait(0.03) | |
139 | local function make1(part) | |
140 | local gr = part.Parent:findFirstChild("Part") | |
141 | local portaldoor = Instance.new("Part", workspace) | |
142 | portaldoor.Size = Vector3.new(6.09, 5.84, 5.93) | |
143 | portaldoor.BrickColor = BrickColor.new("Deep orange") | |
144 | portaldoor.Anchored = true | |
145 | portaldoor.Material = "Neon" | |
146 | portaldoor.Shape = "Ball" | |
147 | portaldoor.CanCollide = false | |
148 | if orangeexists == true then | |
149 | workspace.OrangePortal:destroy() | |
150 | end | |
151 | orangeexists = true | |
152 | portaldoor.Name = "OrangePortal" | |
153 | portaldoor.CFrame = projectile1.CFrame | |
154 | projectile1:destroy() | |
155 | local function tp(part) | |
156 | local hum = part.Parent:findFirstChild("Humanoid") | |
157 | if hum ~= nil and blueexists and orangeexists and not tping then | |
158 | tping = true | |
159 | local tor = part.Parent:findFirstChild("Torso") | |
160 | if tor ~= nil then | |
161 | tor.CFrame = workspace.BluePortal.CFrame | |
162 | end | |
163 | wait(0.1) | |
164 | tping = false | |
165 | end | |
166 | if not hum and blueexists and orangeexists and not tping then | |
167 | tping = true | |
168 | local cube = part.Parent:findFirstChild("Cube") | |
169 | if cube then | |
170 | tping = true | |
171 | cube.CFrame = workspace.BluePortal.CFrame | |
172 | wait(0.1) | |
173 | tping = false | |
174 | end | |
175 | end | |
176 | end | |
177 | portaldoor.Touched:connect(tp) | |
178 | end | |
179 | projectile1.Touched:connect(make1) | |
180 | end | |
181 | ||
182 | for i = 0,1 , 0.3 do | |
183 | wait() | |
184 | lhandweld.C0 = lhandweld.C0 * CFrame.new():lerp(CFrame.Angles(0,0,-0.2),i) | |
185 | rhandweld.C0 = rhandweld.C0 * CFrame.new():lerp(CFrame.Angles(0,0,0.2),i) | |
186 | end | |
187 | for i = 0,1 , 0.3 do | |
188 | wait() | |
189 | lhandweld.C0 = lhandweld.C0 * CFrame.new():lerp(CFrame.Angles(0,0,0.2),i) | |
190 | rhandweld.C0 = rhandweld.C0 * CFrame.new():lerp(CFrame.Angles(0,0,-0.2),i) | |
191 | end | |
192 | using = false | |
193 | end | |
194 | end | |
195 | function remove(key) | |
196 | key = key:lower() | |
197 | if key == "r" then | |
198 | if blueexists or orangeexists or blueexists and orangeexists then | |
199 | workspace.OrangePortal:destroy() | |
200 | workspace.BluePortal:destroy() | |
201 | orangeexists = false | |
202 | blueexists = false | |
203 | end | |
204 | end | |
205 | end | |
206 | impacting = false | |
207 | cubesp = false | |
208 | function cubespawn(key) | |
209 | key = key:lower() | |
210 | if key == "c" then | |
211 | if cubesp then | |
212 | workspace.Cube:destroy() | |
213 | end | |
214 | cubesp = true | |
215 | local coobe = Instance.new("Part", workspace) | |
216 | coobe.Size = Vector3.new(2.774, 2.834, 2.804) | |
217 | coobe:BreakJoints() | |
218 | coobe.Position = game.Players.LocalPlayer.Character.Torso.Position | |
219 | coobe.Name = "Cube" | |
220 | local meh = Instance.new("SpecialMesh", coobe) | |
221 | meh.MeshId = "rbxassetid://464957313" | |
222 | meh.TextureId = "rbxassetid://464957325" | |
223 | meh.Scale = Vector3.new(0.8,0.8,0.8) | |
224 | local function sounds() | |
225 | if not impacting then | |
226 | impacting = true | |
227 | local impactspeed = math.random(0.9,1.1) | |
228 | impact.PlaybackSpeed = impactspeed | |
229 | impact:Play() | |
230 | wait(0.2) | |
231 | impacting = false | |
232 | end | |
233 | end | |
234 | coobe.Touched:connect(sounds) | |
235 | end | |
236 | end | |
237 | function deleterportalsondedth() | |
238 | if orangeexists or blueexists or blueexists and orangeexists then | |
239 | workspace.OrangePortal:destroy() | |
240 | workspace.BluePortal:destroy() | |
241 | if cubesp then | |
242 | workspace.Cube:destroy() | |
243 | end | |
244 | end | |
245 | end | |
246 | game.Players.LocalPlayer.Character.Humanoid.Died:connect(deleterportalsondedth) | |
247 | mouse.KeyDown:connect(cubespawn) | |
248 | mouse.Button1Down:connect(portal) | |
249 | mouse.KeyDown:connect(changeportals) | |
250 | mouse.KeyDown:connect(remove) |