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