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