SHOW:
|
|
- or go back to the newest paste.
1 | --By Rufus14 | |
2 | --Converted with ttyyuu12345's model to script plugin v4 | |
3 | Tool0 = Instance.new("Tool") | |
4 | Part1 = Instance.new("Part") | |
5 | SpecialMesh2 = Instance.new("SpecialMesh") | |
6 | Sound3 = Instance.new("Sound") | |
7 | Sound4 = Instance.new("Sound") | |
8 | Sound5 = Instance.new("Sound") | |
9 | Weld6 = Instance.new("Weld") | |
10 | RemoteEvent8 = Instance.new("RemoteEvent") | |
11 | Part10 = Instance.new("Part") | |
12 | Tool0.Name = "Portal Gun" | |
13 | Part1.Name = "Handle" | |
14 | Part1.Parent = Tool0 | |
15 | Part1.CFrame = CFrame.new(-19.5, 1.25, -36.0124435, 1, 0, -0, 0, 0, 1, 0, -1, 0) | |
16 | Part1.Orientation = Vector3.new(-90, 0, 0) | |
17 | Part1.Position = Vector3.new(-19.5, 1.25, -36.0124435) | |
18 | Part1.Rotation = Vector3.new(-90, 0, 0) | |
19 | Part1.Size = Vector3.new(1, 2.5, 1) | |
20 | Part1.BottomSurface = Enum.SurfaceType.Smooth | |
21 | Part1.TopSurface = Enum.SurfaceType.Smooth | |
22 | SpecialMesh2.Parent = Part1 | |
23 | SpecialMesh2.MeshId = "rbxassetid://445285256" | |
24 | SpecialMesh2.Scale = Vector3.new(0.150000006, 0.150000006, 0.150000006) | |
25 | SpecialMesh2.TextureId = "rbxassetid://445285268" | |
26 | SpecialMesh2.MeshType = Enum.MeshType.FileMesh | |
27 | Sound3.Name = "Blue" | |
28 | Sound3.Parent = Part1 | |
29 | Sound3.SoundId = "rbxassetid://182981554" | |
30 | Sound4.Name = "Orange" | |
31 | Sound4.Parent = Part1 | |
32 | Sound4.SoundId = "rbxassetid://142774034" | |
33 | Sound5.Name = "Invalid" | |
34 | Sound5.Parent = Part1 | |
35 | Sound5.SoundId = "rbxassetid://182981577" | |
36 | Weld6.Parent = Part1 | |
37 | Weld6.C0 = CFrame.new(0.196903229, -0.78666687, 0.0808101892, 1, 0, 0, 0, 0, -1, 0, 1, 0) | |
38 | Weld6.Part0 = Part1 | |
39 | Weld6.Part1 = Part10 | |
40 | Weld6.part1 = Part10 | |
41 | RemoteEvent8.Name = "portal" | |
42 | RemoteEvent8.Parent = Tool0 | |
43 | Part10.Name = "Light" | |
44 | Part10.Parent = Tool0 | |
45 | Part10.CFrame = CFrame.new(-19.3030968, 1.33081019, -35.2257767, 1, 0, 0, 0, 1, 0, 0, 0, 1) | |
46 | Part10.Position = Vector3.new(-19.3030968, 1.33081019, -35.2257767) | |
47 | Part10.Color = Color3.new(0, 1, 1) | |
48 | Part10.Transparency = 1 | |
49 | Part10.Size = Vector3.new(0.230000943, 0.230000943, 0.230000943) | |
50 | Part10.BottomSurface = Enum.SurfaceType.Smooth | |
51 | Part10.BrickColor = BrickColor.new("Toothpaste") | |
52 | Part10.Material = Enum.Material.Neon | |
53 | Part10.TopSurface = Enum.SurfaceType.Smooth | |
54 | Part10.brickColor = BrickColor.new("Toothpaste") | |
55 | Part10.Shape = Enum.PartType.Ball | |
56 | Tool0.Parent = owner.Character | |
57 | coroutine.wrap(function() | |
58 | --By Rufus14 | |
59 | local owner | |
60 | local character | |
61 | equipped = false | |
62 | canshoot = true | |
63 | grabbing = false | |
64 | tool = Tool0 | |
65 | handle = tool.Handle | |
66 | remote = tool:WaitForChild("portal") | |
67 | runservice = game:GetService("RunService") | |
68 | bluesound = handle.Blue | |
69 | orangesound = handle.Orange | |
70 | invalid = handle.Invalid | |
71 | light = tool.Light | |
72 | ||
73 | - | illegalmaterial = {Enum.Material.WoodPlanks, Enum.Material.CorrodedMetal, Enum.Material.Brick, Enum.Material.Cobblestone, Enum.Material.ForceField, Enum.Material.Fabric} |
73 | + | illegalmaterial = {Enum.Material.WoodPlanks, Enum.Material.CorrodedMetal, Enum.Material.Grass, Enum.Material.Brick, Enum.Material.Cobblestone, Enum.Material.ForceField, Enum.Material.Fabric} |
74 | ||
75 | tool.Equipped:connect(function() | |
76 | equipped = true | |
77 | owner = game:GetService("Players"):GetPlayerFromCharacter(tool.Parent) | |
78 | character = owner.Character | |
79 | local rightarm = Instance.new("Weld", character.Torso) | |
80 | rightarm.Part0 = character.Torso | |
81 | rightarm.Part1 = character["Right Arm"] | |
82 | rightarm.C0 = CFrame.new(1.5,0,0) | |
83 | rightarm.Name = "RightArmWeldportal" | |
84 | local leftarm = Instance.new("Weld", character.Torso) | |
85 | leftarm.Part0 = character.Torso | |
86 | leftarm.Part1 = character["Left Arm"] | |
87 | leftarm.C0 = CFrame.new(-1.5,0,0) | |
88 | leftarm.Name = "LeftArmWeldportal" | |
89 | local head = Instance.new("Weld", character.Torso) | |
90 | head.Part0 = character.Torso | |
91 | head.Part1 = character.Head | |
92 | head.C0 = CFrame.new(0,1.5,0) | |
93 | head.Name = "HeadWeldportal" | |
94 | local humanoidrootpart = Instance.new("Weld", character.HumanoidRootPart) | |
95 | humanoidrootpart.Part0 = character.HumanoidRootPart | |
96 | humanoidrootpart.Part1 = character.Torso | |
97 | humanoidrootpart.Name = "HumanoidRootPartWeldportal" | |
98 | end) | |
99 | tool.Unequipped:connect(function() | |
100 | equipped = false | |
101 | if character.Torso:findFirstChild("LeftArmWeldportal") then | |
102 | character.Torso:findFirstChild("LeftArmWeldportal"):destroy() | |
103 | end | |
104 | if character.Torso:findFirstChild("RightArmWeldportal") then | |
105 | character.Torso:findFirstChild("RightArmWeldportal"):destroy() | |
106 | end | |
107 | if character.Torso:findFirstChild("HeadWeldportal") then | |
108 | character.Torso:findFirstChild("HeadWeldportal"):destroy() | |
109 | end | |
110 | if character:findFirstChild("HumanoidRootPart") then | |
111 | if character.HumanoidRootPart:findFirstChild("HumanoidRootPartWeldportal") then | |
112 | character.HumanoidRootPart:findFirstChild("HumanoidRootPartWeldportal"):destroy() | |
113 | end | |
114 | end | |
115 | end) | |
116 | ||
117 | remote.OnServerEvent:connect(function(plr, what, value, value2) | |
118 | if plr ~= owner then return end | |
119 | -- | |
120 | if what == "updatec0" then | |
121 | for i,v in pairs(character:GetDescendants()) do | |
122 | if v.Name == value then | |
123 | v.C0 = value2 | |
124 | end | |
125 | end | |
126 | - | elseif what == "grab" then |
126 | + | |
127 | - | if not grabbing then |
127 | + | |
128 | - | grabbing = true |
128 | + | |
129 | - | light.Transparency = 0 |
129 | + | |
130 | - | light.BrickColor = BrickColor.new("Institutional white") |
130 | + | |
131 | - | for q,w in pairs(value:GetDescendants()) do |
131 | + | |
132 | - | if w.ClassName == "Part" or w.ClassName == "MeshPart" then |
132 | + | |
133 | - | w.Anchored = false |
133 | + | |
134 | value:SetNetworkOwner(nil) | |
135 | end)() | |
136 | else | |
137 | light.Transparency = 1 | |
138 | grabbing = false | |
139 | end | |
140 | elseif what == "closeportals" then | |
141 | light.Transparency = 1 | |
142 | if character.Head:findFirstChild("BluePortal") then | |
143 | local blu = character.Head:findFirstChild("BluePortal") | |
144 | local soundpart = Instance.new("UnionOperation", character.Head) | |
145 | soundpart.Transparency = 1 | |
146 | soundpart.CanCollide = false | |
147 | soundpart.CFrame = blu.CFrame | |
148 | soundpart.Anchored = true | |
149 | local soundclose = Instance.new("Sound", soundpart) | |
150 | soundclose.SoundId = "rbxassetid://182981587" | |
151 | soundclose.Volume = 1 | |
152 | - | local soundpart = Instance.new("Part", character.Head) |
152 | + | |
153 | game.Debris:AddItem(soundpart, soundclose.TimeLength) | |
154 | coroutine.wrap(function() | |
155 | for i = 1,10 do | |
156 | blu.Size = blu.Size - Vector3.new(0.35,0.5,0) | |
157 | runservice.Stepped:wait() | |
158 | end | |
159 | blu:destroy() | |
160 | end)() | |
161 | end | |
162 | if character.Head:findFirstChild("OrangePortal") then | |
163 | local orang = character.Head:findFirstChild("OrangePortal") | |
164 | local soundpart = Instance.new("UnionOperation", character.Head) | |
165 | soundpart.Transparency = 1 | |
166 | soundpart.CanCollide = false | |
167 | soundpart.CFrame = orang.CFrame | |
168 | soundpart.Anchored = true | |
169 | local soundclose = Instance.new("Sound", soundpart) | |
170 | soundclose.SoundId = "rbxassetid://182981587" | |
171 | soundclose.Volume = 1 | |
172 | - | local soundpart = Instance.new("Part", character.Head) |
172 | + | |
173 | game.Debris:AddItem(soundpart, soundclose.TimeLength) | |
174 | coroutine.wrap(function() | |
175 | for i = 1,10 do | |
176 | orang.Size = orang.Size - Vector3.new(0.35,0.5,0) | |
177 | runservice.Stepped:wait() | |
178 | end | |
179 | orang:destroy() | |
180 | end)() | |
181 | end | |
182 | elseif what == "shootblue" then | |
183 | bluesound.PlaybackSpeed = 1+(math.random(-20,20)/120) | |
184 | bluesound:Play() | |
185 | light.Transparency = 0 | |
186 | light.BrickColor = BrickColor.new("Toothpaste") | |
187 | local pellet = Instance.new("Part", character.Head) | |
188 | pellet.Size = Vector3.new(0.7,0.7,1.7) | |
189 | pellet.Name = "pellet" | |
190 | pellet.Material = "Neon" | |
191 | pellet.BrickColor = BrickColor.new("Toothpaste") | |
192 | pellet.CFrame = value * CFrame.new(0,2,0) | |
193 | pellet.CFrame = CFrame.new(pellet.Position, value2.p) | |
194 | pellet.CanCollide = false | |
195 | pellet.Anchored = true | |
196 | Instance.new("PointLight", pellet).Brightness = 4 | |
197 | local mesh = Instance.new("SpecialMesh", pellet) | |
198 | mesh.MeshType = "Sphere" | |
199 | local hitwall = false | |
200 | local ignorelist = {} | |
201 | for i,v in pairs(workspace:GetDescendants()) do | |
202 | if v.ClassName == "Model" then | |
203 | if v:findFirstChildOfClass("Humanoid") then | |
204 | table.insert(ignorelist, v) | |
205 | end | |
206 | end | |
207 | end | |
208 | local function awman() | |
209 | invalid:Play() | |
210 | invalid.PlaybackSpeed = 1+(math.random(-20,20)/120) | |
211 | local boom = Instance.new("Part", character.Head) | |
212 | boom.CanCollide = false | |
213 | boom.Anchored = false | |
214 | boom.Shape = "Ball" | |
215 | boom.Name = "NoPortal" | |
216 | boom.Anchored = true | |
217 | boom.Material = "Neon" | |
218 | boom.CFrame = pellet.CFrame | |
219 | coroutine.wrap(function() | |
220 | for i = 1,10 do | |
221 | boom.Size = boom.Size + Vector3.new(0.15,0.15,0.15) | |
222 | boom.Transparency = boom.Transparency + 0.1 | |
223 | runservice.Stepped:wait() | |
224 | end | |
225 | boom:Destroy() | |
226 | end)() | |
227 | for i = 1,math.random(4,10) do | |
228 | local laser = Instance.new("UnionOperation", character.Head) | |
229 | Instance.new("BlockMesh", laser) | |
230 | laser.BrickColor = BrickColor.new("Toothpaste") | |
231 | laser.Anchored = true | |
232 | laser.Material = "Neon" | |
233 | laser.Name = "NoPortal" | |
234 | laser.Size = Vector3.new(0.1,0.1,1) | |
235 | laser.CanCollide = false | |
236 | - | local laser = Instance.new("Part", character.Head) |
236 | + | |
237 | laser.CFrame = laser.CFrame * CFrame.fromEulerAnglesXYZ(math.random(-10,10)/1.5,math.random(-10,10)/1.5,math.random(-10,10)/1.5) | |
238 | coroutine.wrap(function() | |
239 | for i = 1,20 do | |
240 | laser.Transparency = laser.Transparency + 0.05 | |
241 | laser.CFrame = laser.CFrame * CFrame.new(0,0,-0.1) | |
242 | runservice.Stepped:wait() | |
243 | end | |
244 | laser:destroy() | |
245 | end)() | |
246 | end | |
247 | pellet:destroy() | |
248 | end | |
249 | coroutine.wrap(function() | |
250 | local threshold = 0 | |
251 | while runservice.Stepped:wait() and not hitwall do | |
252 | local ray = Ray.new(pellet.Position, pellet.CFrame.lookVector*8) | |
253 | local rayhit, raypos, raysurface = workspace:FindPartOnRayWithIgnoreList(ray, ignorelist) | |
254 | if rayhit then | |
255 | if rayhit.Name ~= "NoPortal" then | |
256 | hitwall = true | |
257 | if rayhit.Name == "OrangePortal" then | |
258 | awman() | |
259 | return | |
260 | end | |
261 | for i,v in pairs(illegalmaterial) do | |
262 | if v == rayhit.Material then | |
263 | awman() | |
264 | return | |
265 | end | |
266 | end | |
267 | if character.Head:findFirstChild("BluePortal") then | |
268 | character.Head.BluePortal:destroy() | |
269 | end | |
270 | local portal = Instance.new("UnionOperation", character.Head) | |
271 | local mesh = Instance.new("SpecialMesh", portal) | |
272 | mesh.MeshType = "Sphere" | |
273 | portal.Size = Vector3.new(1,1,0.4) | |
274 | portal.Name = "BluePortal" | |
275 | portal.BrickColor = BrickColor.new("Toothpaste") | |
276 | portal.Material = "Neon" | |
277 | portal.CanCollide = false | |
278 | - | local portal = Instance.new("Part", character.Head) |
278 | + | |
279 | portal.CFrame = CFrame.new(raypos, raypos-raysurface) | |
280 | coroutine.wrap(function() | |
281 | for i = 1,10 do | |
282 | portal.Size = portal.Size + Vector3.new(0.35,0.5,0) | |
283 | runservice.Stepped:wait() | |
284 | end | |
285 | end)() | |
286 | local portalopen = Instance.new("Sound", portal) | |
287 | portalopen.SoundId = "rbxassetid://171399373" | |
288 | portalopen.Volume = 1.5 | |
289 | portalopen.PlaybackSpeed = 1+(math.random(-20,20)/120) | |
290 | portalopen:Play() | |
291 | local portalidle = Instance.new("Sound", portal) | |
292 | portalidle.SoundId = "rbxassetid://148894502" | |
293 | portalidle.Volume = 0.25 | |
294 | portalidle:Play() | |
295 | portalidle.Looped = true | |
296 | local gothroughsound = Instance.new("Sound", portal) | |
297 | gothroughsound.Volume = 3 | |
298 | game.Debris:AddItem(portalopen, portalopen.TimeLength) | |
299 | portal.Touched:connect(function(part) | |
300 | if part.Anchored then return end | |
301 | gothroughsound.PlaybackSpeed = 1+(math.random(-20,20)/120) | |
302 | if part.Parent.ClassName == "Accessory" or part.Parent.ClassName == "Hat" or part.Parent.ClassName == "Tool" then | |
303 | if part.Parent.Parent ~= workspace then | |
304 | --print("ignored hat on player") | |
305 | return | |
306 | end | |
307 | end | |
308 | if character.Head:findFirstChild("OrangePortal") then | |
309 | local humus = part.Parent:findFirstChildOfClass("Humanoid") | |
310 | if humus then | |
311 | local head = part.Parent:findFirstChild("Head") | |
312 | if head then | |
313 | local wentthrough = part.Parent:findFirstChild("wentthroughportal") | |
314 | --[[if wentthrough then | |
315 | print("returned from head tp") | |
316 | return | |
317 | end--]] | |
318 | if not wentthrough then | |
319 | local wentth = Instance.new("BoolValue", part.Parent) | |
320 | wentth.Name = "wentthroughportal" | |
321 | game.Debris:AddItem(wentth, 0.4) | |
322 | local headvelocity = head.Velocity | |
323 | if headvelocity.y < -50 or headvelocity.y > 50 or headvelocity.z < -50 or headvelocity.z > 50 or headvelocity.x < -50 or headvelocity.x > 50 then | |
324 | gothroughsound.SoundId = "rbxassetid://2769872789" | |
325 | else | |
326 | gothroughsound.SoundId = "rbxassetid://232806289" | |
327 | end | |
328 | gothroughsound:Play() | |
329 | head.CFrame = character.Head.OrangePortal.CFrame * CFrame.new(0,2,4) | |
330 | local px,py,pz = character.Head.OrangePortal.CFrame:toEulerAnglesXYZ() | |
331 | head.CFrame = CFrame.new(head.Position) * CFrame.fromEulerAnglesXYZ(0,py,0) | |
332 | local pushv = Instance.new("BodyVelocity", head) | |
333 | pushv.MaxForce = Vector3.new(math.huge,math.huge,math.huge) | |
334 | pushv.Velocity = character.Head.OrangePortal.CFrame.lookVector * (-15 + headvelocity.y/1.2) | |
335 | humus:ChangeState(Enum.HumanoidStateType.GettingUp) | |
336 | game.Debris:AddItem(pushv, 0.2) | |
337 | end | |
338 | else | |
339 | local wentthrough = part:findFirstChild("wentthroughportal") | |
340 | --[[if wentthrough then | |
341 | print("returned from humanoid part tp") | |
342 | return | |
343 | end--]] | |
344 | if not wentthrough then | |
345 | local wentth = Instance.new("BoolValue", part) | |
346 | wentth.Name = "wentthroughportal" | |
347 | game.Debris:AddItem(wentth, 0.4) | |
348 | local partvelocity = part.Velocity | |
349 | if partvelocity.y < -50 or partvelocity.y > 50 or partvelocity.z < -50 or partvelocity.z > 50 or partvelocity.x < -50 or partvelocity.x > 50 then | |
350 | gothroughsound.SoundId = "rbxassetid://2769872789" | |
351 | else | |
352 | gothroughsound.SoundId = "rbxassetid://232806289" | |
353 | end | |
354 | gothroughsound:Play() | |
355 | part.CFrame = character.Head.OrangePortal.CFrame * CFrame.new(0,2,4) | |
356 | local pushv = Instance.new("BodyVelocity", part) | |
357 | pushv.MaxForce = Vector3.new(math.huge,math.huge,math.huge) | |
358 | pushv.Velocity = character.Head.OrangePortal.CFrame.lookVector * (-15 + partvelocity.y/1.2) | |
359 | game.Debris:AddItem(pushv, 0.2) | |
360 | end | |
361 | end | |
362 | else | |
363 | local wentthrough = part:findFirstChild("wentthroughportal") | |
364 | --[[if wentthrough then | |
365 | print("returned from part tp") | |
366 | return | |
367 | end--]] | |
368 | if not wentthrough then | |
369 | local wentth = Instance.new("BoolValue", part) | |
370 | wentth.Name = "wentthroughportal" | |
371 | game.Debris:AddItem(wentth, 0.4) | |
372 | local partvelocity = part.Velocity | |
373 | if partvelocity.y < -50 or partvelocity.y > 50 or partvelocity.z < -50 or partvelocity.z > 50 or partvelocity.x < -50 or partvelocity.x > 50 then | |
374 | gothroughsound.SoundId = "rbxassetid://2769872789" | |
375 | else | |
376 | gothroughsound.SoundId = "rbxassetid://232806289" | |
377 | end | |
378 | gothroughsound:Play() | |
379 | part.CFrame = character.Head.OrangePortal.CFrame * CFrame.new(0,2,4) | |
380 | local pushv = Instance.new("BodyVelocity", part) | |
381 | pushv.MaxForce = Vector3.new(math.huge,math.huge,math.huge) | |
382 | pushv.Velocity = character.Head.OrangePortal.CFrame.lookVector * (-15 + partvelocity.y/1.2) | |
383 | game.Debris:AddItem(pushv, 0.2) | |
384 | end | |
385 | end | |
386 | end | |
387 | end) | |
388 | else | |
389 | awman() | |
390 | end | |
391 | end | |
392 | pellet.CFrame = pellet.CFrame * CFrame.new(0,0,-8) | |
393 | threshold = threshold + 1 | |
394 | if threshold == 200 then | |
395 | pellet:destroy() | |
396 | break | |
397 | end | |
398 | end | |
399 | pellet:destroy() | |
400 | end)() | |
401 | elseif what == "shootorange" then | |
402 | orangesound.PlaybackSpeed = 1+(math.random(-20,20)/120) | |
403 | orangesound:Play() | |
404 | light.Transparency = 0 | |
405 | light.BrickColor = BrickColor.new("Deep orange") | |
406 | local pellet = Instance.new("Part", character.Head) | |
407 | pellet.Size = Vector3.new(0.7,0.7,1.7) | |
408 | pellet.Material = "Neon" | |
409 | pellet.Name = "pellet" | |
410 | pellet.BrickColor = BrickColor.new("Deep orange") | |
411 | pellet.CFrame = value * CFrame.new(0,2,0) | |
412 | pellet.CFrame = CFrame.new(pellet.Position, value2.p) | |
413 | pellet.CanCollide = false | |
414 | pellet.Anchored = true | |
415 | Instance.new("PointLight", pellet).Brightness = 4 | |
416 | local mesh = Instance.new("SpecialMesh", pellet) | |
417 | mesh.MeshType = "Sphere" | |
418 | local hitwall = false | |
419 | local ignorelist = {} | |
420 | for i,v in pairs(workspace:GetDescendants()) do | |
421 | if v.ClassName == "Model" then | |
422 | if v:findFirstChildOfClass("Humanoid") then | |
423 | table.insert(ignorelist, v) | |
424 | end | |
425 | end | |
426 | end | |
427 | local function awman() | |
428 | invalid:Play() | |
429 | invalid.PlaybackSpeed = 1+(math.random(-20,20)/120) | |
430 | local boom = Instance.new("Part", character.Head) | |
431 | boom.CanCollide = false | |
432 | boom.Anchored = true | |
433 | boom.Shape = "Ball" | |
434 | boom.Name = "NoPortal" | |
435 | boom.Material = "Neon" | |
436 | boom.CFrame = pellet.CFrame | |
437 | coroutine.wrap(function() | |
438 | for i = 1,10 do | |
439 | boom.Size = boom.Size + Vector3.new(0.15,0.15,0.15) | |
440 | boom.Transparency = boom.Transparency + 0.1 | |
441 | runservice.Stepped:wait() | |
442 | end | |
443 | boom:Destroy() | |
444 | end)() | |
445 | for i = 1,math.random(4,10) do | |
446 | local laser = Instance.new("UnionOperation", character.Head) | |
447 | Instance.new("BlockMesh", laser) | |
448 | laser.BrickColor = BrickColor.new("Deep orange") | |
449 | laser.Size = Vector3.new(0.1,0.1,1) | |
450 | laser.Anchored = true | |
451 | laser.Material = "Neon" | |
452 | laser.Name = "NoPortal" | |
453 | laser.CanCollide = false | |
454 | - | local laser = Instance.new("Part", character.Head) |
454 | + | |
455 | laser.CFrame = laser.CFrame * CFrame.fromEulerAnglesXYZ(math.random(-10,10)/1.5,math.random(-10,10)/1.5,math.random(-10,10)/1.5) | |
456 | coroutine.wrap(function() | |
457 | for i = 1,20 do | |
458 | laser.Transparency = laser.Transparency + 0.05 | |
459 | laser.CFrame = laser.CFrame * CFrame.new(0,0,-0.1) | |
460 | runservice.Stepped:wait() | |
461 | end | |
462 | laser:destroy() | |
463 | end)() | |
464 | end | |
465 | pellet:destroy() | |
466 | end | |
467 | coroutine.wrap(function() | |
468 | local threshold = 0 | |
469 | while runservice.Stepped:wait() and not hitwall do | |
470 | local ray = Ray.new(pellet.Position, pellet.CFrame.lookVector*8) | |
471 | local rayhit, raypos, raysurface = workspace:FindPartOnRayWithIgnoreList(ray, ignorelist) | |
472 | if rayhit then | |
473 | if rayhit.Name ~= "NoPortal" then | |
474 | hitwall = true | |
475 | if rayhit.Name == "BluePortal" then | |
476 | awman() | |
477 | return | |
478 | end | |
479 | for i,v in pairs(illegalmaterial) do | |
480 | if v == rayhit.Material then | |
481 | awman() | |
482 | return | |
483 | end | |
484 | end | |
485 | if character.Head:findFirstChild("OrangePortal") then | |
486 | character.Head.OrangePortal:destroy() | |
487 | end | |
488 | local portal = Instance.new("UnionOperation", character.Head) | |
489 | local mesh = Instance.new("SpecialMesh", portal) | |
490 | mesh.MeshType = "Sphere" | |
491 | portal.Size = Vector3.new(1,1,0.4) | |
492 | portal.Name = "OrangePortal" | |
493 | portal.BrickColor = BrickColor.new("Deep orange") | |
494 | portal.Material = "Neon" | |
495 | portal.CanCollide = false | |
496 | - | local portal = Instance.new("Part", character.Head) |
496 | + | |
497 | portal.CFrame = CFrame.new(raypos, raypos-raysurface) | |
498 | coroutine.wrap(function() | |
499 | for i = 1,10 do | |
500 | portal.Size = portal.Size + Vector3.new(0.35,0.5,0) | |
501 | runservice.Stepped:wait() | |
502 | end | |
503 | end)() | |
504 | local portalopen = Instance.new("Sound", portal) | |
505 | portalopen.SoundId = "rbxassetid://171399373" | |
506 | portalopen.Volume = 1.5 | |
507 | portalopen.PlaybackSpeed = 1+(math.random(-20,20)/120) | |
508 | portalopen:Play() | |
509 | local portalidle = Instance.new("Sound", portal) | |
510 | portalidle.SoundId = "rbxassetid://148894502" | |
511 | portalidle.Volume = 0.25 | |
512 | portalidle:Play() | |
513 | portalidle.Looped = true | |
514 | local gothroughsound = Instance.new("Sound", portal) | |
515 | gothroughsound.Volume = 1.5 | |
516 | game.Debris:AddItem(portalopen, portalopen.TimeLength) | |
517 | portal.Touched:connect(function(part) | |
518 | if part.Anchored then return end | |
519 | gothroughsound.PlaybackSpeed = 1+(math.random(-20,20)/120) | |
520 | if part.Parent.ClassName == "Accessory" or part.Parent.ClassName == "Hat" or part.Parent.ClassName == "Tool" then | |
521 | if part.Parent.Parent ~= workspace then | |
522 | --print("ignored hat on player") | |
523 | return | |
524 | end | |
525 | end | |
526 | if character.Head:findFirstChild("BluePortal") then | |
527 | local humus = part.Parent:findFirstChildOfClass("Humanoid") | |
528 | if humus then | |
529 | local head = part.Parent:findFirstChild("Head") | |
530 | if head then | |
531 | local wentthrough = part.Parent:findFirstChild("wentthroughportal") | |
532 | --[[if wentthrough then | |
533 | print("returned from head tp") | |
534 | return | |
535 | end--]] | |
536 | if not wentthrough then | |
537 | local wentth = Instance.new("BoolValue", part.Parent) | |
538 | wentth.Name = "wentthroughportal" | |
539 | game.Debris:AddItem(wentth, 0.4) | |
540 | local headvelocity = head.Velocity | |
541 | if headvelocity.y < -50 or headvelocity.y > 50 or headvelocity.z < -50 or headvelocity.z > 50 or headvelocity.x < -50 or headvelocity.x > 50 then | |
542 | gothroughsound.SoundId = "rbxassetid://2769872789" | |
543 | else | |
544 | gothroughsound.SoundId = "rbxassetid://232806289" | |
545 | end | |
546 | gothroughsound:Play() | |
547 | head.CFrame = character.Head.BluePortal.CFrame * CFrame.new(0,2,4) | |
548 | local px,py,pz = character.Head.BluePortal.CFrame:toEulerAnglesXYZ() | |
549 | head.CFrame = CFrame.new(head.Position) * CFrame.fromEulerAnglesXYZ(0,py,0) | |
550 | local pushv = Instance.new("BodyVelocity", head) | |
551 | pushv.MaxForce = Vector3.new(math.huge,math.huge,math.huge) | |
552 | pushv.Velocity = character.Head.BluePortal.CFrame.lookVector * (-15 + headvelocity.y/1.2) | |
553 | humus:ChangeState(Enum.HumanoidStateType.GettingUp) | |
554 | game.Debris:AddItem(pushv, 0.2) | |
555 | end | |
556 | else | |
557 | local wentthrough = part:findFirstChild("wentthroughportal") | |
558 | --[[if wentthrough then | |
559 | print("returned from humanoid part tp") | |
560 | return | |
561 | end--]] | |
562 | if not wentthrough then | |
563 | local wentth = Instance.new("BoolValue", part) | |
564 | wentth.Name = "wentthroughportal" | |
565 | game.Debris:AddItem(wentth, 0.4) | |
566 | local partvelocity = part.Velocity | |
567 | if partvelocity.y < -50 or partvelocity.y > 50 or partvelocity.z < -50 or partvelocity.z > 50 or partvelocity.x < -50 or partvelocity.x > 50 then | |
568 | gothroughsound.SoundId = "rbxassetid://2769872789" | |
569 | else | |
570 | gothroughsound.SoundId = "rbxassetid://232806289" | |
571 | end | |
572 | gothroughsound:Play() | |
573 | part.CFrame = character.Head.BluePortal.CFrame * CFrame.new(0,2,4) | |
574 | local pushv = Instance.new("BodyVelocity", part) | |
575 | pushv.MaxForce = Vector3.new(math.huge,math.huge,math.huge) | |
576 | pushv.Velocity = character.Head.BluePortal.CFrame.lookVector * (-15 + partvelocity.y/1.2) | |
577 | game.Debris:AddItem(pushv, 0.2) | |
578 | end | |
579 | end | |
580 | else | |
581 | local wentthrough = part:findFirstChild("wentthroughportal") | |
582 | --[[if wentthrough then | |
583 | print("returned from part tp") | |
584 | return | |
585 | end--]] | |
586 | if not wentthrough then | |
587 | local wentth = Instance.new("BoolValue", part) | |
588 | wentth.Name = "wentthroughportal" | |
589 | game.Debris:AddItem(wentth, 0.4) | |
590 | local partvelocity = part.Velocity | |
591 | if partvelocity.y < -50 or partvelocity.y > 50 or partvelocity.z < -50 or partvelocity.z > 50 or partvelocity.x < -50 or partvelocity.x > 50 then | |
592 | gothroughsound.SoundId = "rbxassetid://2769872789" | |
593 | else | |
594 | gothroughsound.SoundId = "rbxassetid://232806289" | |
595 | end | |
596 | gothroughsound:Play() | |
597 | part.CFrame = character.Head.BluePortal.CFrame * CFrame.new(0,2,4) | |
598 | local pushv = Instance.new("BodyVelocity", part) | |
599 | pushv.MaxForce = Vector3.new(math.huge,math.huge,math.huge) | |
600 | pushv.Velocity = character.Head.BluePortal.CFrame.lookVector * (-15 + partvelocity.y/1.2) | |
601 | game.Debris:AddItem(pushv, 0.2) | |
602 | end | |
603 | end | |
604 | end | |
605 | end) | |
606 | else | |
607 | awman() | |
608 | end | |
609 | end | |
610 | pellet.CFrame = pellet.CFrame * CFrame.new(0,0,-8) | |
611 | threshold = threshold + 1 | |
612 | if threshold == 200 then | |
613 | pellet:destroy() | |
614 | break | |
615 | end | |
616 | end | |
617 | pellet:destroy() | |
618 | end)() | |
619 | end | |
620 | end) | |
621 | end)() | |
622 | NLS([[ | |
623 | local owner | |
624 | local character | |
625 | local rootpart | |
626 | local charhum | |
627 | mouse = game:GetService("Players").LocalPlayer:GetMouse() | |
628 | equipped = false | |
629 | canshoot = true | |
630 | grabbingwho = nil | |
631 | runservice = game:GetService("RunService") | |
632 | tool = script.Parent | |
633 | handle = tool.Handle | |
634 | remote = tool:WaitForChild("portal") | |
635 | bluesound = handle.Blue | |
636 | orangesound = handle.Orange | |
637 | invalid = handle.Invalid | |
638 | ||
639 | zoffset = 0 | |
640 | yoffset = 0 | |
641 | xoffset = 0 | |
642 | xrotoffset = 0 | |
643 | yrotoffset = 0 | |
644 | zrotoffset = 0 | |
645 | xrotoffsetportal = 0 | |
646 | yrotoffsetportal = 0 | |
647 | zrotoffsetportal = 0 | |
648 | ||
649 | tool.Unequipped:connect(function() | |
650 | equipped = false | |
651 | charhum.AutoRotate = true | |
652 | if character["Right Arm"]:findFirstChild("RightGriplocal") then | |
653 | character["Right Arm"]:findFirstChild("RightGriplocal"):destroy() | |
654 | end | |
655 | if character.Torso:findFirstChild("LeftArmWeldportallocal") then | |
656 | character.Torso:findFirstChild("LeftArmWeldportallocal"):destroy() | |
657 | end | |
658 | if character.Torso:findFirstChild("RightArmWeldportallocal") then | |
659 | character.Torso:findFirstChild("RightArmWeldportallocal"):destroy() | |
660 | end | |
661 | if character.Torso:findFirstChild("HeadWeldportallocal") then | |
662 | character.Torso:findFirstChild("HeadWeldportallocal"):destroy() | |
663 | end | |
664 | if character:findFirstChild("HumanoidRootPart") then | |
665 | if character.HumanoidRootPart:findFirstChild("HumanoidRootPartWeldportallocal") then | |
666 | character.HumanoidRootPart:findFirstChild("HumanoidRootPartWeldportallocal"):destroy() | |
667 | end | |
668 | end | |
669 | end) | |
670 | ||
671 | orangeshot = false | |
672 | ||
673 | mouse.KeyDown:connect(function(key) | |
674 | if not equipped then return end | |
675 | key = key:lower() | |
676 | if key == "r" then | |
677 | remote:FireServer("closeportals") | |
678 | for i = 1,20 do | |
679 | yrotoffsetportal = math.sin(i/2)/8 | |
680 | runservice.RenderStepped:wait() | |
681 | end | |
682 | yrotoffsetportal = 0 | |
683 | elseif key == "e" then | |
684 | if grabbingwho == nil then | |
685 | local ray = Ray.new(character.Head.Position, character.Head.CFrame.lookVector*7) | |
686 | local hitray, hitposition = workspace:FindPartOnRayWithIgnoreList(ray, {character}) | |
687 | if hitray then | |
688 | if not hitray.Anchored then | |
689 | grabbingwho = hitray | |
690 | canshoot = false | |
691 | remote:FireServer("grab", hitray) | |
692 | coroutine.wrap(function() | |
693 | while runservice.RenderStepped:wait() do | |
694 | if grabbingwho ~= nil then | |
695 | grabbingwho.Velocity = Vector3.new() | |
696 | grabbingwho.CFrame = grabbingwho.CFrame:lerp(character.Head.CFrame * CFrame.new(0,0,-7), 0.1) | |
697 | end | |
698 | end | |
699 | end)() | |
700 | end | |
701 | end | |
702 | else | |
703 | grabbingwho = nil | |
704 | remote:FireServer("grab") | |
705 | for i = 1,20 do | |
706 | yrotoffsetportal = math.sin(i/2)/8 | |
707 | runservice.RenderStepped:wait() | |
708 | end | |
709 | yrotoffsetportal = 0 | |
710 | canshoot = true | |
711 | end | |
712 | end | |
713 | end) | |
714 | ||
715 | mouse.Button1Down:connect(function() | |
716 | if equipped and canshoot then | |
717 | remote:FireServer("shootblue", handle.CFrame, mouse.Hit) | |
718 | for i = 1,10 do | |
719 | zoffset = math.cos(i/12)/1.5 | |
720 | xrotoffset = math.cos(i/12)/5 | |
721 | runservice.RenderStepped:wait() | |
722 | end | |
723 | xrotoffset = 0 | |
724 | zoffset = 0 | |
725 | end | |
726 | end) | |
727 | mouse.Button2Down:connect(function() | |
728 | orangeshot = true | |
729 | coroutine.wrap(function() | |
730 | if orangeshot then | |
731 | wait(0.1) | |
732 | orangeshot = false | |
733 | end | |
734 | end)() | |
735 | end) | |
736 | mouse.Button2Up:connect(function() | |
737 | if equipped and canshoot then | |
738 | if orangeshot then | |
739 | remote:FireServer("shootorange", handle.CFrame, mouse.Hit) | |
740 | for i = 1,10 do | |
741 | zoffset = math.cos(i/12)/1.5 | |
742 | xrotoffset = math.cos(i/12)/5 | |
743 | runservice.RenderStepped:wait() | |
744 | end | |
745 | xrotoffset = 0 | |
746 | zoffset = 0 | |
747 | end | |
748 | end | |
749 | end) | |
750 | ||
751 | tool.Equipped:connect(function() | |
752 | equipped = true | |
753 | owner = game:GetService("Players").LocalPlayer | |
754 | character = owner.Character | |
755 | charhum = character:findFirstChildOfClass("Humanoid") | |
756 | charhum.AutoRotate = false | |
757 | rootpart = character.HumanoidRootPart | |
758 | mouse = owner:GetMouse() | |
759 | character["Right Arm"]:WaitForChild("RightGrip") | |
760 | local fakegrip = Instance.new("Weld", character["Right Arm"]) | |
761 | fakegrip.Part0 = character["Right Arm"] | |
762 | fakegrip.Part1 = handle | |
763 | fakegrip.Name = "RightGriplocal" | |
764 | fakegrip.C0 = CFrame.new(0.0172424316, -1.10172808, -0.631057739, 0.939694643, 0.342014611, 1.5361735e-06, 0.336815238, -0.925408483, -0.173644245, -0.0593881048, 0.163174912, -0.984808147) | |
765 | local rightarm = Instance.new("Weld", character.Torso) | |
766 | rightarm.Part0 = character.Torso | |
767 | rightarm.Part1 = character["Right Arm"] | |
768 | rightarm.C0 = CFrame.new(1.5,0,0) | |
769 | rightarm.Name = "RightArmWeldportallocal" | |
770 | local leftarm = Instance.new("Weld", character.Torso) | |
771 | leftarm.Part0 = character.Torso | |
772 | leftarm.Part1 = character["Left Arm"] | |
773 | leftarm.C0 = CFrame.new(-1.5,0,0) | |
774 | leftarm.Name = "LeftArmWeldportallocal" | |
775 | local head = Instance.new("Weld", character.Torso) | |
776 | head.Part0 = character.Torso | |
777 | head.Part1 = character.Head | |
778 | head.C0 = CFrame.new(0,1.5,0) | |
779 | head.Name = "HeadWeldportallocal" | |
780 | local humanoidrootpart = Instance.new("Weld", rootpart) | |
781 | humanoidrootpart.Part0 = rootpart | |
782 | humanoidrootpart.Part1 = character.Torso | |
783 | humanoidrootpart.Name = "HumanoidRootPartWeldportallocal" | |
784 | coroutine.wrap(function() | |
785 | while wait() and equipped do --send c0 | |
786 | remote:FireServer("updatec0", "RightGrip", fakegrip.C0) | |
787 | remote:FireServer("updatec0", "HeadWeldportal", head.C0) | |
788 | remote:FireServer("updatec0", "HumanoidRootPartWeldportal", humanoidrootpart.C0) | |
789 | remote:FireServer("updatec0", "LeftArmWeldportal", leftarm.C0) | |
790 | remote:FireServer("updatec0", "RightArmWeldportal", rightarm.C0) | |
791 | end | |
792 | end)() | |
793 | coroutine.wrap(function() | |
794 | while runservice.RenderStepped:wait() and equipped do | |
795 | if rootpart.Velocity.x >= 2 or rootpart.Velocity.x <= -2 or rootpart.Velocity.z >= 2 or rootpart.Velocity.z <= -2 then | |
796 | xoffset = math.sin(tick()*5)/10 | |
797 | yoffset = math.sin(tick()*10)/10 | |
798 | elseif rootpart.Velocity.x <= 2 or rootpart.Velocity.x >= -2 or rootpart.Velocity.z <= 2 or rootpart.Velocity.z >= -2 then | |
799 | xoffset = 0 | |
800 | yoffset = math.sin(tick())/20 | |
801 | --print("standing") | |
802 | end | |
803 | end | |
804 | end)() | |
805 | coroutine.wrap(function() | |
806 | while runservice.RenderStepped:wait() and equipped do | |
807 | character["Left Arm"].LocalTransparencyModifier = 0 | |
808 | character["Right Arm"].LocalTransparencyModifier = 0 | |
809 | for q,w in pairs(character.Head:GetDescendants()) do | |
810 | if w.Name == "NoPortal" or w.Name == "BluePortal" or w.Name == "OrangePortal" or w.Name == "pellet" then | |
811 | w.LocalTransparencyModifier = 0 | |
812 | end | |
813 | end | |
814 | if (workspace.CurrentCamera.CFrame.p - character.Head.CFrame.p).magnitude <= 1.5 then | |
815 | charhum.CameraOffset = Vector3.new(0,0.5,0) | |
816 | else | |
817 | charhum.CameraOffset = Vector3.new(0,0,0) | |
818 | end | |
819 | local absvel = rootpart.CFrame:vectorToObjectSpace(rootpart.Velocity) | |
820 | humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.fromEulerAnglesXYZ(absvel.z/120,0,-absvel.x/120),0.1) | |
821 | if not charhum.PlatformStand then | |
822 | rootpart.CFrame = rootpart.CFrame:lerp(CFrame.new(rootpart.Position, Vector3.new(mouse.Hit.p.x,rootpart.Position.y,mouse.Hit.p.z)),0.2) | |
823 | else | |
824 | charhum.PlatformStand = false | |
825 | end | |
826 | fakegrip.C0 = fakegrip.C0:lerp(CFrame.new(0.0172424316, -1.10172808, -0.631057739, 0.939694643, 0.342014611, 1.5361735e-06, 0.336815238, -0.925408483, -0.173644245, -0.0593881048, 0.163174912, -0.984808147) * CFrame.fromEulerAnglesXYZ(xrotoffsetportal,yrotoffsetportal,zrotoffsetportal),0.2) | |
827 | head.C0 = head.C0:lerp(CFrame.new(0,1,0) * CFrame.fromEulerAnglesXYZ(((mouse.Hit.p-mouse.Origin.p).unit.y),0,0) * CFrame.new(0,0.5,0),0.2) | |
828 | leftarm.C0 = leftarm.C0:lerp(CFrame.new(-0.3+xoffset,-0.3+yoffset,-0.5+zoffset) * CFrame.fromEulerAnglesXYZ((((mouse.Hit.p-mouse.Origin.p).unit.y)+math.pi/2)+xrotoffset,yrotoffset,math.rad(30)+zrotoffset) * CFrame.new(0,-1,-0.5),0.2) | |
829 | rightarm.C0 = rightarm.C0:lerp(CFrame.new(1+xoffset,0+yoffset,-0.3+zoffset) * CFrame.fromEulerAnglesXYZ((((mouse.Hit.p-mouse.Origin.p).unit.y)+math.pi/2)+xrotoffset,yrotoffset,math.rad(-20)+zrotoffset) * CFrame.new(0,-0.5,-0.5),0.2) | |
830 | end | |
831 | character["Left Arm"].LocalTransparencyModifier = 0 | |
832 | character["Right Arm"].LocalTransparencyModifier = 0 | |
833 | charhum.CameraOffset = Vector3.new(0,0,0) | |
834 | end)() | |
835 | end)]], Tool0) |