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