View difference between Paste ID: Jcrt4vvc and TFZYf1ca
SHOW: | | - or go back to the newest paste.
1
  wait(1)--this was so much work i did not change the animations from the last stand sorry...
2
warn "Slenercat5's"
3
warn "Dirty Deeds Done Dirt Cheep"
4
warn "Q to call stand"
5
warn "E to do far range attack"
6
warn "R to make Enemy clone"
7
warn "T to jump to other dimension"
8
warn "Y to Make Clone"
9
warn "F to use love train"
10
warn "moveset based on project jojo's d4c"
11
warn "Model by JojofMer"
12
warn"sorry currently 1 color"
13
warn "Avatar clothing and hair by Masterofroblox1206"
14
plr = game.Players.LocalPlayer
15-
mse = plr:GetMouse()
15+
16
sound.SoundId = "https://www.roblox.com/asset/?id=274698941"
17
sound.Volume = 10
18
canworld = true
19
BeeSpeed = 50
20
21
chr=plr.Character
22
tors=torso
23
--[[
24
for _,v in pairs(plr.Character:GetChildren())do
25
if v:IsA('Shirt') or v:IsA('Pants') or v:IsA('Accessory') then
26
	v:remove()
27
end
28
end
29
local sh = Instance.new("Shirt",chr)
30
sh.ShirtTemplate = "http://www.roblox.com/asset/?id=394790364"
31
p=Instance.new('Pants',chr)
32
p.PantsTemplate='http://www.roblox.com/asset/?id=394795102'--]]
33
34
chr['Left Arm'].BrickColor=BrickColor.new('Pastel brown')
35
chr['Right Arm'].BrickColor=BrickColor.new('Pastel brown')
36
chr['Torso'].BrickColor=BrickColor.new('Pastel brown')
37
chr.Head.BrickColor=BrickColor.new('Pastel brown')
38
39
40
41
42
local Players=game:service'Players'
43
local Player=Players.LocalPlayer
44
Character=Player.Character
45-
local Mouse=Player:GetMouse''
45+
46
local RenderStepped=game:service'RunService'.Heartbeat
47
48-
local RenderStepped=game:service'RunService'.RenderStepped
48+
49
local TextureId='http://www.roblox.com/asset/?id=775493027'
50
51
52
local QHold=false
53
local EHold=false
54
55
cut = Instance.new("Sound", chr)
56
cut.SoundId = "https://www.roblox.com/asset/?id=0"
57
cut.Volume = 1.5
58
thri = Instance.new("Sound", chr)
59
thri.SoundId = "https://www.roblox.com/asset/?id=186311262"
60
thri.Volume = 2.5
61
62
63
Sound2=Instance.new('Sound')
64
Sound2.SoundId='rbxassetid://616594063'
65
Sound2.Parent=Player.Character.Head
66
67
68
  Effects = {}
69
  local Player = game.Players.localPlayer
70
  local Character = Player.Character
71
  Character.Archivable = true
72
  AdvancingFortress = Character:Clone()
73
--[[
74
Hair=Instance.new('Part',Character)
75
Hair.Size=Vector3.new(1,1,1)
76
M=Instance.new('FileMesh',Hair)
77
M.Scale=Vector3.new(.028,.028,.028)
78
M.MeshId='rbxassetid://1450916371'
79
M.TextureId='rbxassetid://1450916523'
80
WARF=Instance.new('Weld',Hair)
81
WARF.Part0=Hair
82
WARF.Part1=Character.Head
83
WARF.C0=CFrame.new(0,-.2,0)--]]
84
85
86
--//D4cCostume
87
88
function eclone(targetPart)
89
	
90
--Converted with ttyyuu12345's model to script plugin v4
91
function sandbox(var,func)
92
	local env = getfenv(func)
93
	local newenv = setmetatable({},{
94
		__index = function(self,k)
95
			if k=="script" then
96
				return var
97
			else
98
				return env[k]
99
			end
100
		end,
101
	})
102
	setfenv(func,newenv)
103
	return func
104
end
105
cors = {}
106
mas = Instance.new("Model",game:GetService("Lighting"))
107
Model0 = Instance.new("Model")
108
Part1 = Instance.new("Part")
109
SpecialMesh2 = Instance.new("SpecialMesh")
110
Decal3 = Instance.new("Decal")
111
Part4 = Instance.new("Part")
112
Decal5 = Instance.new("Decal")
113
Motor6 = Instance.new("Motor")
114
Motor7 = Instance.new("Motor")
115
Motor8 = Instance.new("Motor")
116
Motor9 = Instance.new("Motor")
117
Motor10 = Instance.new("Motor")
118
Part11 = Instance.new("Part")
119
Part12 = Instance.new("Part")
120
Part13 = Instance.new("Part")
121
Part14 = Instance.new("Part")
122
Humanoid15 = Instance.new("Humanoid")
123
Humanoid15.WalkToPart=targetPart
124
BodyColors16 = Instance.new("BodyColors")
125
Script17 = Instance.new("Script")
126
Model0.Name = "Clone"
127
Model0.Parent = mas
128
Model0.PrimaryPart = Part1
129
Part1.Name = "Head"
130
Part1.Parent = Model0
131
Part1.BrickColor = BrickColor.new("Bright yellow")
132
Part1.FormFactor = Enum.FormFactor.Symmetric
133
Part1.Size = Vector3.new(2, 1, 1)
134
Part1.CFrame = CFrame.new(6.34995413, 4.50001717, 23.1599998, 1, 0, 0, 0, 1, 0, 0, 0, 1)
135
Part1.TopSurface = Enum.SurfaceType.Smooth
136
Part1.Color = Color3.new(0.960784, 0.803922, 0.188235)
137
Part1.Position = Vector3.new(6.34995413, 4.50001717, 23.1599998)
138
Part1.Color = Color3.new(0.960784, 0.803922, 0.188235)
139
SpecialMesh2.Parent = Part1
140
SpecialMesh2.Scale = Vector3.new(1.25, 1.25, 1.25)
141
SpecialMesh2.Scale = Vector3.new(1.25, 1.25, 1.25)
142
Decal3.Name = "face"
143
Decal3.Parent = Part1
144
Decal3.Texture = "rbxasset://textures/face.png"
145
Part4.Name = "Torso"
146
Part4.Parent = Model0
147
Part4.BrickColor = BrickColor.new("Bright blue")
148
Part4.FormFactor = Enum.FormFactor.Symmetric
149
Part4.Size = Vector3.new(2, 2, 1)
150
Part4.CFrame = CFrame.new(6.34995413, 3.00001717, 23.1599998, 1, 0, 0, 0, 1, 0, 0, 0, 1)
151
Part4.LeftSurface = Enum.SurfaceType.Weld
152
Part4.RightSurface = Enum.SurfaceType.Weld
153
Part4.Color = Color3.new(0.0509804, 0.411765, 0.67451)
154
Part4.Position = Vector3.new(6.34995413, 3.00001717, 23.1599998)
155
Part4.Color = Color3.new(0.0509804, 0.411765, 0.67451)
156
Decal5.Name = "roblox"
157
Decal5.Parent = Part4
158
Motor6.Name = "Right Shoulder"
159
Motor6.Parent = Part4
160
Motor6.C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
161
Motor6.C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
162
Motor6.Part0 = Part4
163
Motor6.Part1 = Part12
164
Motor6.MaxVelocity = 0.15000000596046
165
Motor7.Name = "Left Shoulder"
166
Motor7.Parent = Part4
167
Motor7.C0 = CFrame.new(-1, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
168
Motor7.C1 = CFrame.new(0.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
169
Motor7.Part0 = Part4
170
Motor7.Part1 = Part11
171
Motor7.MaxVelocity = 0.15000000596046
172
Motor8.Name = "Right Hip"
173
Motor8.Parent = Part4
174
Motor8.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
175
Motor8.C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
176
Motor8.Part0 = Part4
177
Motor8.Part1 = Part14
178
Motor8.MaxVelocity = 0.10000000149012
179
Motor9.Name = "Left Hip"
180
Motor9.Parent = Part4
181
Motor9.C0 = CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
182
Motor9.C1 = CFrame.new(-0.5, 1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
183
Motor9.Part0 = Part4
184
Motor9.Part1 = Part13
185
Motor9.MaxVelocity = 0.10000000149012
186
Motor10.Name = "Neck"
187
Motor10.Parent = Part4
188
Motor10.C0 = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
189
Motor10.C1 = CFrame.new(0, -0.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
190
Motor10.Part0 = Part4
191
Motor10.Part1 = Part1
192
Motor10.MaxVelocity = 0.10000000149012
193
Part11.Name = "Left Arm"
194
Part11.Parent = Model0
195
Part11.BrickColor = BrickColor.new("Bright yellow")
196
Part11.CanCollide = false
197
Part11.FormFactor = Enum.FormFactor.Symmetric
198
Part11.Size = Vector3.new(1, 2, 1)
199
Part11.CFrame = CFrame.new(4.84995413, 3.00001717, 23.1599998, 1, 0, 0, 0, 1, 0, 0, 0, 1)
200
Part11.Color = Color3.new(0.960784, 0.803922, 0.188235)
201
Part11.Position = Vector3.new(4.84995413, 3.00001717, 23.1599998)
202
Part11.Color = Color3.new(0.960784, 0.803922, 0.188235)
203
Part12.Name = "Right Arm"
204
Part12.Parent = Model0
205
Part12.BrickColor = BrickColor.new("Bright yellow")
206
Part12.CanCollide = false
207
Part12.FormFactor = Enum.FormFactor.Symmetric
208
Part12.Size = Vector3.new(1, 2, 1)
209
Part12.CFrame = CFrame.new(7.84995413, 3.00001717, 23.1599998, 1, 0, 0, 0, 1, 0, 0, 0, 1)
210
Part12.Color = Color3.new(0.960784, 0.803922, 0.188235)
211
Part12.Position = Vector3.new(7.84995413, 3.00001717, 23.1599998)
212
Part12.Color = Color3.new(0.960784, 0.803922, 0.188235)
213
Part13.Name = "Left Leg"
214
Part13.Parent = Model0
215
Part13.BrickColor = BrickColor.new("Br. yellowish green")
216
Part13.CanCollide = false
217
Part13.FormFactor = Enum.FormFactor.Symmetric
218
Part13.Size = Vector3.new(1, 2, 1)
219
Part13.CFrame = CFrame.new(5.84995413, 1.00001717, 23.1599998, 1, 0, 0, 0, 1, 0, 0, 0, 1)
220
Part13.BottomSurface = Enum.SurfaceType.Smooth
221
Part13.TopSurface = Enum.SurfaceType.Inlet
222
Part13.Color = Color3.new(0.643137, 0.741176, 0.278431)
223
Part13.Position = Vector3.new(5.84995413, 1.00001717, 23.1599998)
224
Part13.Color = Color3.new(0.643137, 0.741176, 0.278431)
225
Part14.Name = "Right Leg"
226
Part14.Parent = Model0
227
Part14.BrickColor = BrickColor.new("Br. yellowish green")
228
Part14.CanCollide = false
229
Part14.FormFactor = Enum.FormFactor.Symmetric
230
Part14.Size = Vector3.new(1, 2, 1)
231
Part14.CFrame = CFrame.new(6.84995413, 1.00001717, 23.1599998, 1, 0, 0, 0, 1, 0, 0, 0, 1)
232
Part14.BottomSurface = Enum.SurfaceType.Smooth
233
Part14.TopSurface = Enum.SurfaceType.Inlet
234
Part14.Color = Color3.new(0.643137, 0.741176, 0.278431)
235
Part14.Position = Vector3.new(6.84995413, 1.00001717, 23.1599998)
236
Part14.Color = Color3.new(0.643137, 0.741176, 0.278431)
237
Humanoid15.Parent = Model0
238
Humanoid15.NameOcclusion = Enum.NameOcclusion.NoOcclusion
239
Humanoid15.RightLeg = Part14
240
Humanoid15.LeftLeg = Part13
241
Humanoid15.Torso = Part4
242
Humanoid15.WalkToPoint=Vector3.new(0,20,0)
243
BodyColors16.Parent = Model0
244
BodyColors16.HeadColor = BrickColor.new("Bright yellow")
245
BodyColors16.LeftArmColor = BrickColor.new("Bright yellow")
246
BodyColors16.LeftLegColor = BrickColor.new("Br. yellowish green")
247
BodyColors16.RightArmColor = BrickColor.new("Bright yellow")
248
BodyColors16.RightLegColor = BrickColor.new("Br. yellowish green")
249
BodyColors16.TorsoColor = BrickColor.new("Bright blue")
250
Script17.Name = "Full Animation"
251
Script17.Parent = Model0
252
table.insert(cors,sandbox(Script17,function()
253
--[[Made by Jammer622 @[http://www.roblox.com/Advanced-Player-AI-item?id=59391730],
254
This is the ORIGINAL model, if you see others, they are stolen.
255
Scripts mixed from vanilla Animate, Health, and Sound,
256
with much custom content by myself, making them great AIs.
257
No help from Miked's scripts, I made my own joint script.
258
If you find any glitches, bugs, or just want to suggest an idea, please message me.
259
My team works hard on these AIs, please don't make attempts to steal them.
260
Your feedback is extremely appreciated!
261
262
	_---=CREDITS=---_
263
The Roblox Team		Without them, none of this would be possible.
264
	Vanilla Sound
265
	Vanilla Health
266
	Vanilla Animate
267
Jammer622				That's me, main programmer and weapon publisher.
268
	Main Developer
269
	Health GUI Script
270
	Animation Work
271
	Relationship Work
272
	Wandering
273
	Pathing (Map Generation)
274
	Weapon Usage
275
	Weapon (Re)Publishing
276
		Sonypony458
277
			McDonalds Drink
278
	Customization
279
	Teamwork AI
280
	Model Variables
281
	Setting Wiki [Below]
282
Macdeath					I owe it to him for keeping me on track during this.
283
	Feature Inspiration
284
	Problem Solving
285
	Suggestions
286
lah30303					Amazing pathing work goes to this fine sir.
287
	Pathing (Pathing Generation/System)
288
289
	_---=SETTINGS=---_
290
Inside this model's file, you'll find several values that can be changed.
291
	DropWeapon					-This sets whether or not the bot will drop any equipped weapon upon dying.
292
	Force_Pants					-This must be set through Spawners.
293
	Force_Shirt					-This must be set through Spawners.
294
	Force_Weapon				-This must be set through Spawners.
295
	Force_Hat					-This must be set through Spawners.
296
	IgnoreCombatFF				-This sets whether or not the bot will allow friendly fire during combat.
297
	IsAPlayer					-This is a tag to specify this bot's existance to other AIs.
298
	IsOnTeam						-This sets whether or not the bot is on a team.
299
		ShowTag					-This sets whether or not the bot's team color name shows up beside its own.
300
		Team						-This sets the bot's team color.
301
	PathTo						-This is an experimental pathfinding engine. Use at your own risk!
302
	PrintMap						-This prints maps generated when using PathTo. Use at your own risk!
303
	Respawn						-This sets whether the bot will respawn or not upon death.
304
	Custom_Name					-This must be set through Spawners.
305
	Wander						-This sets whether the bot is stationary or if it moves, but not if it uses weapons or not.
306
]]
307
print("Player Bot Loading")
308
Delay(0, function() --Vanilla Sound
309
	function waitForChild(parent, childName)
310
		local child = parent:findFirstChild(childName)
311
		if child then return child end
312
		while true do
313
			child = parent.ChildAdded:wait()
314
			if child.Name==childName then return child end
315
		end
316
	end
317
	function newSound(id)
318
		local sound = Instance.new("Sound")
319
		sound.SoundId = id
320
		sound.archivable = false
321
		sound.Parent = script.Parent.Head
322
		return sound
323
	end
324
	local sDied = newSound("rbxasset://sounds/uuhhh.wav")
325
	local sFallingDown = newSound("rbxasset://sounds/splat.wav")
326
	local sFreeFalling = newSound("rbxasset://sounds/swoosh.wav")
327
	local sGettingUp = newSound("rbxasset://sounds/hit.wav")
328
	local sJumping = newSound("rbxasset://sounds/button.wav")
329
	local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3")
330
	sRunning.Looped = true
331
	local Figure = script.Parent
332
	local Head = waitForChild(Figure, "Head")
333
	local Humanoid = waitForChild(Figure, "Humanoid")
334
	function onDied()
335
		sDied:Play()
336
	end
337
	function onState(state, sound)
338
		if state then
339
			sound:Play()
340
		else
341
			sound:Pause()
342
		end
343
	end
344
	function onRunning(speed)
345
		if speed>0 then
346
			sRunning:Play()
347
		else
348
			sRunning:Pause()
349
		end
350
	end
351
	
352
	Humanoid.Died:connect(onDied)
353
	Humanoid.Running:connect(onRunning)
354
	Humanoid.Jumping:connect(function(state) onState(state, sJumping) end)
355
	Humanoid.GettingUp:connect(function(state) onState(state, sGettingUp) end)
356
	Humanoid.FreeFalling:connect(function(state) onState(state, sFreeFalling) end)
357
	Humanoid.FallingDown:connect(function(state) onState(state, sFallingDown) end)
358
end)
359
Delay(0, function() --Vanilla Health
360
	function waitForChild(parent, childName)
361
		local child = parent:findFirstChild(childName)
362
		if child then return child end
363
		while true do
364
			child = parent.ChildAdded:wait()
365
			if child.Name==childName then return child end
366
		end
367
	end
368
	local Figure = script.Parent
369
	local Humanoid = waitForChild(Figure, "Humanoid")
370
	local regening = false
371
	function regenHealth()
372
		if regening then return end
373
		regening = true
374
		while Humanoid.Health < Humanoid.MaxHealth do
375
			local s = wait(1)
376
			local health = Humanoid.Health
377
			if health > 0 and health < Humanoid.MaxHealth then
378
				local newHealthDelta = 0.01 * s * Humanoid.MaxHealth
379
				health = health + newHealthDelta
380
				Humanoid.Health = math.min(health,Humanoid.MaxHealth)
381
			end
382
		end
383
		if Humanoid.Health > Humanoid.MaxHealth then
384
			Humanoid.Health = Humanoid.MaxHealth
385
		end
386
		regening = false
387
	end
388
	Humanoid.HealthChanged:connect(regenHealth)
389
end)
390
Delay(0, function() --Vanilla Animate, Multiple Additions
391
	function waitForChild(parent, childName)
392
		local child = parent:findFirstChild(childName)
393
		if child then return child end
394
		while true do
395
			child = parent.ChildAdded:wait()
396
			if child.Name==childName then return child end
397
		end
398
	end
399
	local Figure = script.Parent
400
	local Clone = Figure:Clone()
401
	local Torso = waitForChild(Figure, "Torso")
402
	local Joints = Torso:GetChildren()
403
	for All = 1, #Joints do
404
		if Joints.className == "Motor" or Joints.className == "Motor6D" then
405
			Joints[All]:Remove()
406
		end
407
	end
408
	local RightShoulder = Instance.new("Motor")
409
	local LeftShoulder = Instance.new("Motor")
410
	local RightHip = Instance.new("Motor")
411
	local LeftHip = Instance.new("Motor")
412
	local Neck = Instance.new("Motor")
413
	local Humanoid = waitForChild(Figure, "Humanoid")
414
	ZStat = 1
415
	ZStat2 = 0
416
	local pose = "Standing"
417
	RightShoulder.Part0 = Torso
418
	RightShoulder.Part1 = Figure["Right Arm"]
419
	RightShoulder.MaxVelocity = 0.15
420
	RightShoulder.Name = "Right Shoulder"
421
	RightShoulder.C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
422
	RightShoulder.C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
423
	RightShoulder.Parent = Torso
424
	LeftShoulder.Part0 = Torso
425
	LeftShoulder.Part1 = Figure["Left Arm"]
426
	LeftShoulder.MaxVelocity = 0.15
427
	LeftShoulder.Name = "Left Shoulder"
428
	LeftShoulder.C0 = CFrame.new(-1, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
429
	LeftShoulder.C1 = CFrame.new(0.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
430
	LeftShoulder.Parent = Torso
431
	RightHip.Part0 = Torso
432
	RightHip.Part1 = Figure["Right Leg"]
433
	RightHip.MaxVelocity = 0.1
434
	RightHip.Name = "Right Hip"
435
	RightHip.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
436
	RightHip.C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
437
	RightHip.Parent = Torso
438
	LeftHip.Part0 = Torso
439
	LeftHip.Part1 = Figure["Left Leg"]
440
	LeftHip.MaxVelocity = 0.1
441
	LeftHip.Name = "Left Hip"
442
	LeftHip.C0 = CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
443
	LeftHip.C1 = CFrame.new(-0.5, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
444
	LeftHip.Parent = Torso
445
	Neck.Part0 = Torso
446
	Neck.Part1 = Figure["Head"]
447
	Neck.MaxVelocity = 0.1
448
	Neck.Name = "Neck"
449
	Neck.C0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
450
	Neck.C1 = CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
451
	Neck.Parent = Torso
452
	local toolAnim = "None"
453
	local toolAnimTime = 0
454
	SpawnModel = Instance.new("Model")
455
	function onRunning(speed)
456
		if speed>0 then
457
			pose = "Running"
458
		else
459
			pose = "Standing"
460
		end
461
	end
462
	function CheckTag(Tag)
463
		if script.Parent:FindFirstChild("IsLocalEnemy") == nil and script.Parent:FindFirstChild("IsAZombie") == nil and Tag.ClassName == "ObjectValue" and Tag.Value ~= nil and Tag.Value.ClassName == "Player" and Tag.Value.Character ~= nil then
464
			if Tag.Value.Character:FindFirstChild("IsLocalEnemy") == nil then
465
				if (script.Parent.IsOnTeam.Value == true and IsInCombat == false and script.Parent.IsOnTeam.Team.Value == Tag.Value.TeamColor) or script.Parent.IsOnTeam.Value == false then
466
					local Tag2 = Instance.new("CFrameValue", Tag.Value.Character)
467
					Tag2.Name = "IsLocalEnemy"
468
					print(Tag.Value.Character.Name .." Has Become An Outlaw")
469
				end
470
			end
471
			if Tag.Value.Character:FindFirstChild("Loc" ..script.Parent.Name) ~= nil then
472
				Tag.Value.Character:FindFirstChild("Loc" ..script.Parent.Name):Remove()
473
			end
474
			local Found = Instance.new("CFrameValue", Tag.Value.Character)
475
			Found.Name = "Loc" ..script.Parent.Name
476
			game:GetService("Debris"):AddItem(Found, 3)
477
		elseif script.Parent:FindFirstChild("IsLocalEnemy") == nil and script.Parent:FindFirstChild("IsAZombie") == nil and Tag.ClassName == "StringValue" and game.Players:FindFirstChild(Tag.Value) ~= nil and game.Players[Tag.Value].Character ~= nil then
478
			if game.Players[Tag.Value].Character:FindFirstChild("IsLocalEnemy") == nil then
479
				if (script.Parent.IsOnTeam.Value == true and IsInCombat == false and script.Parent.IsOnTeam.Team.Value == game.Players[Tag.Value].TeamColor) or script.Parent.IsOnTeam.Value == false then
480
					local Tag2 = Instance.new("CFrameValue", game.Players[Tag.Value].Character)
481
					Tag2.Name = "IsLocalEnemy"
482
					print(Tag.Value .." Has Become An Outlaw")
483
				end
484
			end
485
			if game.Players[Tag.Value].Character:FindFirstChild("Loc" ..script.Parent.Name) ~= nil then
486
				game.Players[Tag.Value].Character:FindFirstChild("Loc" ..script.Parent.Name):Remove()
487
			end
488
			local Found = Instance.new("CFrameValue", game.Players[Tag.Value].Character)
489
			Found.Name = "Loc" ..script.Parent.Name
490
			game:GetService("Debris"):AddItem(Found, 3)
491
		elseif script.Parent:FindFirstChild("IsLocalEnemy") == nil and script.Parent:FindFirstChild("IsAZombie") == nil and Tag.ClassName == "StringValue" and game.Workspace:FindFirstChild(Tag.Value) ~= nil then
492
			if game.Workspace[Tag.Value]:FindFirstChild("IsLocalEnemy") == nil then
493
				if (script.Parent.IsOnTeam.Value == true and IsInCombat == false and Workspace[Tag.Value].IsOnTeam.Value == true and script.Parent.IsOnTeam.Team.Value == Workspace[Tag.Value].IsOnTeam.Team.Value) or script.Parent.IsOnTeam.Value == false or Workspace[Tag.Value].IsOnTeam.Value == false then
494
					local Tag2 = Instance.new("CFrameValue", game.Workspace[Tag.Value])
495
					Tag2.Name = "IsLocalEnemy"
496
					print(Tag.Value .." Has Become An Outlaw")
497
				end
498
			end
499
			if game.Workspace[Tag.Value]:FindFirstChild("Loc" ..script.Parent.Name) ~= nil then
500
				game.Workspace[Tag.Value]:FindFirstChild("Loc" ..script.Parent.Name):Remove()
501
			end
502
			local Found = Instance.new("CFrameValue", game.Workspace[Tag.Value])
503
			Found.Name = "Loc" ..script.Parent.Name
504
			game:GetService("Debris"):AddItem(Found, 3)
505
		elseif (script.Parent:FindFirstChild("IsLocalEnemy") ~= nil or script.Parent:FindFirstChild("IsAZombie") ~= nil) and Tag.ClassName == "ObjectValue" and Tag.Value ~= nil and Tag.Value.ClassName == "Player" and Tag.Value.Character ~= nil then
506
			local Found = Instance.new("CFrameValue", Tag.Value.Character)
507
			Found.Name = "Loc" ..script.Parent.Name
508
			game:GetService("Debris"):AddItem(Found, 3)
509
		elseif (script.Parent:FindFirstChild("IsLocalEnemy") ~= nil or script.Parent:FindFirstChild("IsAZombie") ~= nil) and Tag.ClassName == "StringValue" and game.Workspace:FindFirstChild(Tag.Value) ~= nil then
510
			local Found = Instance.new("CFrameValue", game.Workspace[Tag.Value])
511
			Found.Name = "Loc" ..script.Parent.Name
512
			game:GetService("Debris"):AddItem(Found, 3)
513
		end
514
	end
515
	function CheckSpawns(Object)
516
		local Parts = Object:GetChildren()
517
		for Check = 1, #Parts do
518
			if Parts[Check].className == "SpawnLocation" then
519
				local I = Instance.new("Vector3Value", SpawnModel)
520
				I.Value = Parts[Check].Position
521
			end
522
			CheckSpawns(Parts[Check])
523
		end
524
	end
525
	function onDied()
526
		pose = "Dead"
527
		Delay(5, function()
528
			if script.Parent.Respawn.Value == true then
529
				CheckSpawns(Workspace)
530
				local Spawn = SpawnModel:GetChildren()
531
				Clone.Parent = game.Workspace
532
				if #Spawn > 0 then
533
					Spawn = Spawn[math.random(1, #Spawn)].Value
534
					Clone:MoveTo(Spawn)
535
				else
536
					Clone:MoveTo(Vector3.new(0, 50, 0))
537
				end
538
			end
539
			Figure:Remove()
540
			return
541
		end)
542
	end
543
	function onJumping()
544
		pose = "Jumping"
545
	end
546
	function onClimbing()
547
		pose = "Climbing"
548
	end
549
	function onGettingUp()
550
		pose = "GettingUp"
551
	end
552
	function onFreeFall()
553
		pose = "FreeFall"
554
	end
555
	function onFallingDown()
556
		pose = "FallingDown"
557
	end
558
	function onSeated()
559
		pose = "Seated"
560
	end
561
	function onPlatformStanding()
562
		pose = "PlatformStanding"
563
	end
564
	function moveJump()
565
		RightShoulder.MaxVelocity = 0.5
566
		LeftShoulder.MaxVelocity = 0.5
567
		RightShoulder.DesiredAngle = (3.14/ZStat)
568
		LeftShoulder.DesiredAngle = (-3.14/ZStat)
569
		RightHip.DesiredAngle = (0)
570
		LeftHip.DesiredAngle = (0)
571
	end
572
	function moveFreeFall()
573
		RightShoulder.MaxVelocity = 0.5
574
		LeftShoulder.MaxVelocity = 0.5
575
		RightShoulder.DesiredAngle = (3.14/ZStat)
576
		LeftShoulder.DesiredAngle = (-3.14/ZStat)
577
		RightHip.DesiredAngle = (0)
578
		LeftHip.DesiredAngle = (0)
579
	end
580
	function moveSit()
581
		RightShoulder.MaxVelocity = 0.15
582
		LeftShoulder.MaxVelocity = 0.15
583
		RightShoulder.DesiredAngle = (3.14 /2)
584
		LeftShoulder.DesiredAngle = (-3.14 /2)
585
		RightHip.DesiredAngle = (3.14 /2)
586
		LeftHip.DesiredAngle = (-3.14 /2)
587
	end
588
	function getTool()	
589
		for _, kid in ipairs(Figure:GetChildren()) do
590
			if kid.className == "Tool" then return kid end
591
		end
592
		return nil
593
	end
594
	function getToolAnim(tool)
595
		for _, c in ipairs(tool:GetChildren()) do
596
			if c.Name == "toolanim" and c.className == "StringValue" then
597
				return c
598
			end
599
		end
600
		return nil
601
	end
602
	function animateTool()
603
		if (toolAnim == "None") then
604
			RightShoulder.DesiredAngle = (1.57)
605
			return
606
		end
607
		if (toolAnim == "Slash") then
608
			RightShoulder.MaxVelocity = 0.5
609
			RightShoulder.DesiredAngle = (0)
610
			return
611
		end
612
		if (toolAnim == "Lunge") then
613
			RightShoulder.MaxVelocity = 0.5
614
			LeftShoulder.MaxVelocity = 0.5
615
			RightHip.MaxVelocity = 0.5
616
			LeftHip.MaxVelocity = 0.5
617
			RightShoulder.DesiredAngle = (1.57)
618
			LeftShoulder.DesiredAngle = (1.0)
619
			RightHip.DesiredAngle = (1.57)
620
			LeftHip.DesiredAngle = (1.0)
621
			return
622
		end
623
	end
624
	function move(time)
625
		local amplitude
626
		local frequency
627
		if (pose == "Jumping") then
628
			moveJump()
629
			return
630
		end
631
		if (pose == "FreeFall") then
632
			moveFreeFall()
633
			return
634
		end	 
635
		if (pose == "Seated") then
636
			moveSit()
637
			return
638
		end
639
		local climbFudge = 0
640
		if (pose == "Running") then
641
			RightShoulder.MaxVelocity = 0.15
642
			LeftShoulder.MaxVelocity = 0.15
643
			amplitude = 1
644
			frequency = 9
645
		elseif (pose == "Climbing") then
646
			RightShoulder.MaxVelocity = 0.5 
647
			LeftShoulder.MaxVelocity = 0.5
648
			amplitude = 1
649
			frequency = 9
650
			climbFudge = 3.14
651
		else
652
			amplitude = 0.1
653
			frequency = 1
654
		end
655
		desiredAngle = amplitude * math.sin(time*frequency)
656
		RightShoulder.DesiredAngle = (desiredAngle + climbFudge) + ZStat2
657
		LeftShoulder.DesiredAngle = (desiredAngle - climbFudge) -ZStat2
658
		RightHip.DesiredAngle = (-desiredAngle)
659
		LeftHip.DesiredAngle = (-desiredAngle)
660
		local tool = getTool()
661
		if tool then
662
			animStringValueObject = getToolAnim(tool)
663
			if animStringValueObject then
664
				toolAnim = animStringValueObject.Value
665
				animStringValueObject.Parent = nil
666
				toolAnimTime = time + .3
667
			end
668
			if time > toolAnimTime then
669
				toolAnimTime = 0
670
				toolAnim = "None"
671
			end
672
			animateTool()
673
		else
674
			toolAnim = "None"
675
			toolAnimTime = 0
676
		end
677
	end
678
	Humanoid.Died:connect(onDied)
679
	Humanoid.Running:connect(onRunning)
680
	Humanoid.Jumping:connect(onJumping)
681
	Humanoid.Climbing:connect(onClimbing)
682
	Humanoid.GettingUp:connect(onGettingUp)
683
	Humanoid.FreeFalling:connect(onFreeFall)
684
	Humanoid.FallingDown:connect(onFallingDown)
685
	Humanoid.Seated:connect(onSeated)
686
	Humanoid.PlatformStanding:connect(onPlatformStanding)
687
	Humanoid.ChildAdded:connect(CheckTag)
688
	OriginalTime = 0.1
689
	Time = OriginalTime
690
	while Figure.Parent~=nil do
691
		Time = Time + 0.1
692
		wait(OriginalTime)
693
		move(Time)
694
	end
695
end)
696
Delay(0, function() --lah30303's Pathing Script
697
	function CalcMoves(map, px, py, tx, ty) 
698
		if map[ty][tx] ~= 0 then
699
			return nil
700
		end
701
		local openlist, closedlist, listk, closedk, tempH, tempG, xsize, ysize, curbase = {}, {}, 1, 0, math.abs(px - tx) + math.abs(py - ty), 0, #map[1], #map, {}
702
		openlist[1] = {x = px, y = py, g = 0, h = tempH, f = 0 + tempH ,par = 1}
703
		local nodenumber = 0
704
		while listk > 0 do
705
			nodenumber = nodenumber + 1
706
			if nodenumber / ScanSkip == math.floor(nodenumber / ScanSkip) then
707
				wait()
708
				if DebugPathing == true then
709
					print("Node", nodenumber)
710
				end
711
			end
712
			closedk = closedk + 1
713
			table.insert(closedlist, closedk, openlist[1])
714
			curbase = closedlist[closedk]
715
			if closedlist[closedk].x == tx and closedlist[closedk].y == ty then
716
				return closedlist
717
			end
718
			openlist[1] = openlist[listk]
719
			table.remove(openlist, listk)
720
			listk = listk - 1
721
			local v = 1
722
			while true do
723
				local u = v
724
				if 2 * u + 1 <= listk then
725
					if openlist[u].f >= openlist[2 * u].f then
726
						v = 2 * u
727
					end
728
					if openlist[v].f >= openlist[2 * u + 1].f then
729
						v = 2 * u + 1
730
					end
731
				elseif 2 * u <= listk then
732
					if openlist[u].f >= openlist[2 * u].f then
733
						v = 2 * u
734
					end
735
				end
736
				if u ~= v then
737
					local temp = openlist[u]
738
					openlist[u] = openlist[v]
739
					openlist[v] = temp
740
				else
741
					break
742
				end
743
			end
744
745
			local tocheck = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}, {-1, -1}, {1, -1}, {-1, 1}, {1, 1}} --[1]Right, [2]Left, [3]Down, [4]Up, [5]UpLeft, [6]UpRight, [7]DownLeft, [8]DownRight
746
			if closedk > 0 then
747
				for k = 1, closedk do
748
					for i, v in pairs(tocheck) do
749
						if closedlist[k].x == curbase.x + v[1] and closedlist[k].y == curbase.y + v[2] then
750
							tocheck[i] = nil
751
						end
752
					end
753
				end
754
			end
755
			for i, v in pairs(tocheck) do
756
				local a = curbase.x + v[1]
757
				local b = curbase.y + v[2]
758
				if a > xsize or a < 1 or b > ysize or b < 1 then
759
					tocheck[i] = nil
760
				end
761
			end
762
			for i, v in pairs(tocheck) do
763
				local a, b = curbase.x + v[1], curbase.y + v[2]
764
				if a <= xsize and a >= 1 and b <= ysize and b >= 1 and map[b][a] ~= 0 then
765
					tocheck[i] = nil
766
				end
767
			end
768
			tempG = curbase.g + 1
769
			tempDiagG = curbase.g + 1.4
770
			for k = 1, listk do
771
				for i, v in pairs(tocheck) do
772
					if openlist[k].x == curbase.x + v[1] and openlist[k].y == curbase.y + 1 and openlist[k].g > tempG then
773
						tempH = math.abs((curbase.x + v[1])-tx) + math.abs((curbase.y + v[1])-ty)
774
						table.insert(openlist, k, {x = curbase.x + v[1], y = curbase.y + v[2], g = tempG, h = tempH, f = tempG + tempH, par = closedk})
775
						local m = k
776
						while m ~= 1 do
777
							if openlist[m].f <= openlist[math.floor(m/2)].f then
778
								temp = openlist[math.floor(m/2)]
779
								openlist[math.floor(m/2)] = openlist[m]
780
								openlist[m] = temp
781
								m = math.floor(m/2)
782
							else
783
								break
784
							end
785
							tocheck[i] = nil
786
						end
787
					end
788
				end
789
			end
790
			for i, v in pairs(tocheck) do
791
				listk = listk + 1
792
				tempH = math.abs((curbase.x + v[1]) - tx) + math.abs((curbase.y + v[2]) - ty)
793
				table.insert(openlist, listk, {x = curbase.x + v[1], y = curbase.y + v[2], g = tempG, h = tempH, f = tempG+tempH, par = closedk})
794
				m = listk
795
				while m ~= 1 do
796
					if openlist[m].f <= openlist[math.floor(m/2)].f then
797
						temp = openlist[math.floor(m/2)]
798
						openlist[math.floor(m/2)] = openlist[m]
799
						openlist[m] = temp
800
						m = math.floor(m/2)
801
					else
802
						break
803
					end
804
				end
805
			end
806
		end
807
		return nil
808
	end
809
810
811
	function CalcPath(closedlist)
812
813
		if closedlist == nil or table.getn(closedlist) == 1 then
814
			return nil
815
		end
816
		local path = {}
817
		local pathIndex = {}
818
		local last = table.getn(closedlist)
819
		table.insert(pathIndex,1,last)
820
821
		local i = 1
822
		while pathIndex[i] > 1 do
823
			i = i + 1
824
			table.insert(pathIndex, i, closedlist[pathIndex[i - 1]].par)
825
		end 
826
827
		for n = table.getn(pathIndex) - 1, 1, -1 do
828
			table.insert(path, {x = closedlist[pathIndex[n]].x, y = closedlist[pathIndex[n]].y})
829
		end
830
831
		closedlist = nil
832
		return path
833
	end
834
end)
835
Delay(0, function() --Main Artificial Intelligence Scripting/Path Grid Generator
836
	local Base
837
	if script.Parent:FindFirstChild("BASE") == nil then
838
		Base = Instance.new("Part")
839
		Base.Transparency = 1
840
		Base.TopSurface = "Smooth"
841
		Base.BottomSurface = "Smooth"
842
		Base.CanCollide = false
843
		Base.Anchored = true
844
		Base.Locked = true
845
		Base.BrickColor = BrickColor.new(0, 0, 0)
846
		Base.Name = "BASE"
847
		Base.CFrame = CFrame.new(Vector3.new(0, 0, 0))
848
		Base.Parent = script.Parent
849
	else
850
		Base = script.Parent.BASE
851
		Base.CFrame = CFrame.new(Vector3.new(0, 0, 0))
852
	end
853
	function Jump()
854
		script.Parent.Humanoid.Jump = true
855
	end
856
	function Check(Hit)
857
		if Hit ~= nil and Hit.Parent ~= nil and Hit.Parent.Parent ~= nil then
858
			if Hit.Parent:FindFirstChild("Humanoid") == nil and Hit.Parent.Parent:FindFirstChild("Humanoid") == nil then
859
				Jump()
860
			end
861
		end
862
	end
863
	script.Parent.Torso.Touched:connect(Check)
864
	function Prep(Target, Current, Attempts)
865
		if Attempts == nil then
866
			Attempts = 1000
867
		end
868
		local Hit = false
869
		local Tag = Base:Clone()
870
		Tag.Position = Target
871
		Tag.Parent = script.Parent
872
		local TagRay = Ray.new(Tag.CFrame.p, (CFrame.new(Tag.CFrame.p - Vector3.new(0, 3, 0)).p - Tag.CFrame.p).Unit * 40)
873
		local TRHit, TRPos = game.Workspace:FindPartOnRay(TagRay, script.Parent)
874
		if TRHit ~= nil then
875
			Hit = true
876
		end
877
		if Tag.Parent ~= nil then
878
			Tag:Remove()
879
		end
880
		if Hit == false and Attempts > 0 and script.Parent.Wander.Value == true then
881
			Prep(script.Parent.Torso.Position + Vector3.new(math.random(-100, 100), 0, math.random(-100, 100)), Base, Attempts - 1)
882
		elseif script.Parent.Wander.Value == true then
883
			local TargetRay = Ray.new(script.Parent.Torso.CFrame.p, (CFrame.new(Target).p - script.Parent.Torso.CFrame.p).Unit * ((Target - script.Parent.Torso.Position).Magnitude - 3))
884
			local THit, TPos = game.Workspace:FindPartOnRay(TargetRay, script.Parent)
885
			local TrueTarget = script.Parent.Torso.Position
886
			if THit ~= nil then
887
				for HazardCheck = 1, math.floor((script.Parent.Torso.CFrame.p - TPos).Magnitude) do
888
					local TR2 = Ray.new(script.Parent.Torso.CFrame.p + (TPos - script.Parent.Torso.CFrame.p).Unit * HazardCheck, Vector3.new(0, -50, 0) + (TPos - script.Parent.Torso.CFrame.p).Unit * 3)
889
					local TH2, TP2 = game.Workspace:FindPartOnRay(TR2, script.Parent)
890
					if TH2 ~= nil and TH2.Name ~= "Lava" then
891
						TrueTarget = TP2
892
					else
893
						break
894
					end
895
				end
896
			else
897
				for HazardCheck = 1, math.floor((script.Parent.Torso.CFrame.p - Target).Magnitude) do
898
					local TR2 = Ray.new(script.Parent.Torso.CFrame.p + (Target - script.Parent.Torso.CFrame.p).Unit * HazardCheck, Vector3.new(0, -50, 0) + (TPos - script.Parent.Torso.CFrame.p).Unit * 3)
899
					local TH2, TP2 = game.Workspace:FindPartOnRay(TR2, script.Parent)
900
					if TH2 ~= nil and TH2.Name ~= "Lava" then
901
						TrueTarget = TP2
902
					else
903
						break
904
					end
905
				end
906
			end
907
			script.Parent.Humanoid:MoveTo(TrueTarget, Current)
908
		end
909
	end
910
	function ZHit(Part)
911
		if script.Parent:FindFirstChild("IsAZombie") ~= nil and script.Parent.Humanoid.Health > 0 and Part ~= nil and Part.Parent ~= nil and Part.Parent:FindFirstChild("Humanoid") ~= nil and Part.Parent:FindFirstChild("IsAZombie") == nil then
912
			Part.Parent.Humanoid:TakeDamage(2)
913
			script.Parent.Humanoid.MaxHealth = script.Parent.Humanoid.MaxHealth + 1
914
			script.Parent.Humanoid:TakeDamage(-1)
915
		end
916
	end
917
	script.Parent["Right Arm"].Touched:connect(ZHit)
918
	script.Parent["Left Arm"].Touched:connect(ZHit)
919
	CurrentMap = {}
920
	MapMask = {}
921
	MapVar = {0, 0, 0, 0, 0}
922
	BlockScanned = 0
923
	ScanSkip = 5
924
	DebugPathing = true
925
	function GenerateMap(PathPos)
926
		CurrentMap = {}
927
		MapMask = {}
928
		MapVar = {0, 0, 0, 0, 0}
929
		BlockScanned = 0
930
		MapVariables = ScanParts(Workspace, 1)
931
		for MapX = 1, math.max(-MapVariables[1], MapVariables[2]) * 2 + 1 do
932
			CurrentMap[MapX] = {}
933
			for MapY = 1, math.max(-MapVariables[3], MapVariables[4]) * 2 + 1 do
934
				CurrentMap[MapX][MapY] = 0
935
			end
936
		end
937
		for MaskX = 1, #CurrentMap do
938
			MapMask[MaskX] = {}
939
			for MaskY = 1, #CurrentMap[MaskX] do
940
				MapMask[MaskX][MaskY] = {MapVariables[1] + MaskX - 0.5, MapVariables[1] + MaskY - 0.5}
941
			end
942
		end
943
		ScanParts(Workspace, 2, MapVariables)
944
		wait(1)
945
		if script.Parent.PrintMap.Value == true then
946
			print("Printing Map...")
947
			for ClearPrint = 1, 250 do
948
				wait()
949
				print()
950
			end
951
			for PrintX = 1, #CurrentMap do
952
				local PrintZ = ""
953
				for PrintY = 1, #CurrentMap[PrintX] do
954
					PrintZ = PrintZ ..CurrentMap[PrintX][PrintY]
955
				end
956
				print(PrintZ)
957
				wait(0.1)
958
			end
959
		end
960
		local MapCoords = {0, 0, 0, 0}
961
		local Distance = math.huge
962
		for MPX = 1, #CurrentMap do
963
			for MPY = 1, #CurrentMap[MPX] do
964
				if (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(script.Parent.Torso.Position.X, 0, script.Parent.Torso.Position.Z)).Magnitude < Distance then
965
					MapCoords = {MPX, MPY, 0, 0}
966
					Distance = (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(script.Parent.Torso.Position.X, 0, script.Parent.Torso.Position.Z)).Magnitude
967
				end
968
			end
969
		end
970
		local Distance = math.huge
971
		for MPX = 1, #CurrentMap do
972
			for MPY = 1, #CurrentMap[MPX] do
973
				if (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(script.Parent.PathTo.Value.X, 0, script.Parent.PathTo.Value.Z)).Magnitude < Distance then
974
					MapCoords = {MapCoords[1], MapCoords[2], math.min(MPX, #CurrentMap) - 1, math.min(MPY, #CurrentMap[1] - 1)}
975
					Distance = (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(script.Parent.PathTo.Value.X, 0, script.Parent.PathTo.Value.Z)).Magnitude
976
				end
977
			end
978
		end
979
		for i, v in pairs(CalcPath(CalcMoves(CurrentMap, MapCoords[1], MapCoords[2], MapCoords[3], MapCoords[4]))) do
980
			local Timer = 20
981
			local pX = v["x"]
982
			local pY = v["y"]
983
			local pTo = Vector3.new(MapMask[pX][pY][1], 0, MapMask[pX][pY][2])
984
			pTo = pTo + (pTo - Vector3.new(script.Parent.Torso.Position.X, 0, script.Parent.Torso.Position.Z)).Unit
985
			while (Vector3.new(script.Parent.Torso.Position.X, 0, script.Parent.Torso.Position.Z) - pTo).Magnitude > 2.5 and Timer > 0 do
986
				script.Parent.Humanoid:MoveTo(pTo, Base)
987
				Timer = Timer - 1
988
				if Timer == 10 then
989
					script.Parent.Humanoid.Jump = true
990
				end
991
				wait(0.1)
992
			end
993
			if Timer == 0 then
994
				if (Vector3.new(script.Parent.Torso.Position.X, 0, script.Parent.Torso.Position.Z) - pTo).Magnitude <= 5 then
995
					script.Parent.Torso.CFrame = script.Parent.Torso.CFrame + (pTo - Vector3.new(script.Parent.Torso.Position.X, 0, script.Parent.Torso.Position.Z)).Unit * (pTo - Vector3.new(script.Parent.Torso.Position.X, 0, script.Parent.Torso.Position.Z)).Magnitude
996
				else
997
					break
998
				end
999
			end
1000
		end
1001
	end
1002
	function ScanParts(CurrentModel, CurrentStage, Variables)
1003
		local X = CurrentModel:GetChildren()
1004
		for I = 1, #X do
1005
			if #X[I]:GetChildren() > 0 then
1006
				ScanParts(X[I], 1, Variables)
1007
			end
1008
			if X[I].ClassName == "Part" or X[I].ClassName == "WedgePart" or X[I].ClassName == "CornerWedgePart" or X[I].ClassName == "TrussPart" or X[I].ClassName == "SpawnLocation" or X[I].ClassName == "Seat" or X[I].ClassName == "VehicleSeat" or X[I].ClassName == "SkateboardPlatform" then
1009
				BlockScanned = BlockScanned + 1
1010
				if BlockScanned / ScanSkip == math.floor(BlockScanned / ScanSkip) then
1011
					wait()
1012
					if DebugPathing == true then
1013
						print("Block", BlockScanned)
1014
					end
1015
				end
1016
				if CurrentStage == 1 then
1017
					MapVar[1] = math.min(math.ceil(X[I].Position.X - X[I].Size.X / 2), MapVar[1])
1018
					MapVar[2] = math.max(math.floor(X[I].Position.X + X[I].Size.X / 2), MapVar[2])
1019
					MapVar[3] = math.min(math.ceil(X[I].Position.Z - X[I].Size.Z / 2), MapVar[3])
1020
					MapVar[4] = math.max(math.floor(X[I].Position.Z + X[I].Size.Z / 2), MapVar[4])
1021
				elseif CurrentStage == 2 and ((X[I].Position.Y + X[I].Size.Y / 2 > script.Parent.Torso.Position.Y + 2 and X[I].Position.Y - X[I].Size.Y / 2 < script.Parent.Torso.Position.Y + 2) or X[I].Position.Y + X[I].Size.Y / 2 < script.Parent.Torso.Position.Y - 8) then
1022
					local BlockStart = {X[I].Position.X - X[I].Size.X / 2, X[I].Position.Z - X[I].Size.Z / 2}
1023
					local BlockEnd = {X[I].Position.X + X[I].Size.X / 2, X[I].Position.Z + X[I].Size.Z / 2}
1024
					local BlockCoords = {0, 0, 0, 0}
1025
					local Distance = math.huge
1026
					for MPX = 1, #CurrentMap do
1027
						for MPY = 1, #CurrentMap[MPX] do
1028
							if (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(BlockStart[1], 0, BlockStart[2])).Magnitude < Distance then
1029
								BlockCoords = {MPX, MPY, 0, 0}
1030
								Distance = (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(BlockStart[1], 0, BlockStart[2])).Magnitude
1031
							end
1032
						end
1033
					end
1034
					local Distance = math.huge
1035
					for MPX = 1, #CurrentMap do
1036
						for MPY = 1, #CurrentMap[MPX] do
1037
							if (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(BlockEnd[1], 0, BlockEnd[2])).Magnitude < Distance then
1038
								BlockCoords = {BlockCoords[1], BlockCoords[2], MPX, MPY}
1039
								Distance = (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(BlockEnd[1], 0, BlockEnd[2])).Magnitude
1040
							end
1041
						end
1042
					end
1043
					for XGrid = BlockCoords[2], BlockCoords[4] do
1044
						for YGrid = BlockCoords[1], BlockCoords[3] do
1045
							CurrentMap[XGrid][YGrid] = 1
1046
						end
1047
					end
1048
				end
1049
			end
1050
		end
1051
		if CurrentStage == 1 then
1052
			MapVar[5] = {MapVar[1] + MapVar[2] / 2, MapVar[3] + MapVar[4] / 2}
1053
			return MapVar
1054
		end
1055
	end
1056
	IsInCombat = false
1057
	while script.Parent.Humanoid.Health > 0 and script.Parent:FindFirstChild("IsAZombie") == nil do
1058
		local Distance = 100
1059
		local Target = nil
1060
		IsInCombat = false
1061
		local Players = Workspace:GetChildren()
1062
		for Check = 1, #Players do
1063
			if Players[Check] ~= script.Parent and ((Players[Check]:FindFirstChild("Humanoid") ~= nil and (Players[Check]:FindFirstChild("IsAZombie") ~= nil or Players[Check]:FindFirstChild("IsLocalEnemy") ~= nil or script.Parent:FindFirstChild("IsLocalEnemy") ~= nil or (script.Parent.IsOnTeam.Value == true and Players[Check]:FindFirstChild("IsOnTeam") ~= nil and Players[Check].IsOnTeam.Value == true and script.Parent.IsOnTeam.Team.Value ~= Players[Check].IsOnTeam.Team.Value) or (game.Players:GetPlayerFromCharacter(Players[Check]) ~= nil and script.Parent.IsOnTeam.Value == true and game.Players:GetPlayerFromCharacter(Players[Check]).Neutral == false and game.Players:GetPlayerFromCharacter(Players[Check]).TeamColor ~= script.Parent.IsOnTeam.Team.Value)) and Players[Check].Humanoid.Health > 0) or (Players[Check]:FindFirstChild("Zombie") ~= nil and Players[Check].Zombie.ClassName == "Humanoid" and Players[Check].Zombie.Health > 0)) and Players[Check]:FindFirstChild("Torso") ~= nil and (Players[Check].Torso.Position - script.Parent.Torso.Position).Magnitude <= 100 then
1064
				local Ray = Ray.new(script.Parent.Torso.CFrame.p, (Players[Check].Torso.CFrame.p - script.Parent.Torso.CFrame.p).Unit * 100)
1065
				local Hit, Position = game.Workspace:FindPartOnRay(Ray, script.Parent)
1066
				if Hit ~= nil and Hit.Parent ~= nil and ((Hit.Parent:FindFirstChild("Humanoid") ~= nil and Hit.Parent == Players[Check]) or (Hit.Parent.Parent ~= nil and Hit.Parent.Parent:FindFirstChild("Humanoid") ~= nil and Hit.Parent.Parent == Players[Check])) then
1067
					local TeamTag = nil
1068
					local Parts = Players[Check]:GetChildren()
1069
					for X = 1, #Parts do
1070
						if Parts[X].Name == "TeamLoc" then
1071
							if Parts[X].Value == script.Parent.IsOnTeam.Team.Value then
1072
								TeamTag = Parts[X]
1073
							end
1074
						end
1075
					end
1076
					if Players[Check]:FindFirstChild("Loc" ..script.Parent.Name) ~= nil or Parts[X] ~= nil or (Players[Check].Torso.Position - (script.Parent.Torso.Position + script.Parent.Torso.CFrame.lookVector * 50)).Magnitude <= 52 then
1077
						if script.Parent.IsOnTeam.Value == false then
1078
							if Players[Check]:FindFirstChild("Loc" ..script.Parent.Name) ~= nil then
1079
								Players[Check]:FindFirstChild("Loc" ..script.Parent.Name):Remove()
1080
							end
1081
							local Found = Instance.new("CFrameValue", Players[Check])
1082
							Found.Name = "Loc" ..script.Parent.Name
1083
							game:GetService("Debris"):AddItem(Found, 3)
1084
						else
1085
							if Parts[X] ~= nil then
1086
								Parts[X]:Remove()
1087
							end
1088
							local Found = Instance.new("BrickColorValue", Players[Check])
1089
							Found.Name = "TeamLoc"
1090
							Found.Value = script.Parent.IsOnTeam.Team.Value
1091
							game:GetService("Debris"):AddItem(Found, 3)
1092
							if Players[Check]:FindFirstChild("Loc" ..script.Parent.Name) ~= nil then
1093
								Players[Check]:FindFirstChild("Loc" ..script.Parent.Name):Remove()
1094
							end
1095
							local Found = Instance.new("CFrameValue", Players[Check])
1096
							Found.Name = "Loc" ..script.Parent.Name
1097
							game:GetService("Debris"):AddItem(Found, 3)
1098
						end
1099
					end
1100
					if Players[Check]:FindFirstChild("Loc" ..script.Parent.Name) ~= nil and (Players[Check].Torso.Position - script.Parent.Torso.Position).Magnitude <= Distance then
1101
						Target = Players[Check].Torso
1102
						Distance = (Target.Position - script.Parent.Torso.Position).Magnitude
1103
					end
1104
				end
1105
			end
1106
		end
1107
		if Target == nil then
1108
			local HasTool = false
1109
			local ToolCheck = script.Parent:GetChildren()
1110
			for Check = 1, #ToolCheck do
1111
				if ToolCheck[Check].ClassName == "Tool" then
1112
					HasTool = true
1113
				end
1114
			end
1115
			if HasTool == false then
1116
				Distance = 100
1117
				for Check = 1, #Players do
1118
					if Players[Check].ClassName == "Tool" and Players[Check]:FindFirstChild("Handle") ~= nil and Players[Check]:FindFirstChild("Active") ~= nil and Players[Check]:FindFirstChild("TargetPos") ~= nil and Players[Check]:FindFirstChild("Type") ~= nil and (Players[Check].Handle.Position - script.Parent.Torso.Position).Magnitude <= Distance then
1119
						local Ray = Ray.new(script.Parent.Torso.CFrame.p, (Players[Check].Handle.CFrame.p - script.Parent.Torso.CFrame.p).Unit * 100)
1120
						local Hit, Position = game.Workspace:FindPartOnRay(Ray, script.Parent)
1121
						if Hit ~= nil and Hit.Parent ~= nil and Hit.Parent == Players[Check] then
1122
							Distance = (Players[Check].Handle.Position - script.Parent.Torso.Position).Magnitude
1123
							Target = Players[Check]
1124
						end
1125
					end
1126
				end
1127
				if Target ~= nil and Target.ClassName == "Tool" then
1128
					if Distance <= 5 and HasTool == false then
1129
						Target.Parent = script.Parent
1130
						HasTool = true
1131
					else
1132
						Prep(Target.Handle.Position, Base)
1133
					end
1134
				else
1135
					for Check = 1, #Players do
1136
						if Players[Check].Name == "Crate" and Players[Check]:FindFirstChild("OpenCrate") ~= nil and Players[Check].OpenCrate.Value == false and (Players[Check].Position - script.Parent.Torso.Position).Magnitude <= Distance then
1137
							local Ray = Ray.new(script.Parent.Torso.CFrame.p, (Players[Check].CFrame.p - script.Parent.Torso.CFrame.p).Unit * 100)
1138
							local Hit, Position = game.Workspace:FindPartOnRay(Ray, script.Parent)
1139
							if Hit ~= nil and Hit == Players[Check] then
1140
								Target = Players[Check]
1141
								Distance = (Target.Position - script.Parent.Torso.Position).Magnitude
1142
							end
1143
						end
1144
					end
1145
					if Target ~= nil then
1146
						script.Parent.Humanoid:MoveTo(Target.Position, Target)
1147
						if (Target.Position - script.Parent.Torso.Position).Magnitude <= 10 then
1148
							Target.OpenCrate.Value = true
1149
						end
1150
					else
1151
						local HasHat = false
1152
						local HatCheck = script.Parent:GetChildren()
1153
						for Check = 1, #HatCheck do
1154
							if ToolCheck[Check].ClassName == "Hat" then
1155
								HasHat = true
1156
							end
1157
						end
1158
						if HasHat == false then
1159
							Distance = 100
1160
							for Check = 1, #Players do
1161
								if Players[Check].ClassName == "Hat" and Players[Check]:FindFirstChild("Handle") ~= nil and (Players[Check].Handle.Position - script.Parent.Torso.Position).Magnitude <= Distance then
1162
									local Ray = Ray.new(script.Parent.Torso.CFrame.p, (Players[Check].Handle.CFrame.p - script.Parent.Torso.CFrame.p).Unit * 100)
1163
									local Hit, Position = game.Workspace:FindPartOnRay(Ray, script.Parent)
1164
									if Hit ~= nil and Hit.Parent ~= nil and Hit.Parent == Players[Check] then
1165
										Distance = (Players[Check].Handle.Position - script.Parent.Torso.Position).Magnitude
1166
										Target = Players[Check]
1167
									end
1168
								end
1169
							end
1170
							if Target ~= nil and Target.ClassName == "Hat" then
1171
								if Distance <= 5 and HasHat == false then
1172
									Target.Parent = script.Parent
1173
									HasHat = true
1174
								else
1175
									Prep(Target.Handle.Position, Base)
1176
								end
1177
							else
1178
								if script.Parent.Humanoid.PlatformStand == false and script.Parent.Humanoid.Sit == false then
1179
									if script.Parent.PathTo.Value ~= Vector3.new(0, 0, 0) then
1180
										GenerateMap(script.Parent.PathTo.Value)
1181
										script.Parent.PathTo.Value = Vector3.new(0, 0, 0)
1182
									elseif math.random(1, 10) == 1 and script.Parent.Wander.Value == true then
1183
										Prep(script.Parent.Torso.Position + Vector3.new(math.random(-100, 100), 0, math.random(-100, 100)), Base)
1184
									end
1185
								else
1186
									Jump()
1187
								end
1188
							end
1189
						end
1190
					end
1191
				end
1192
			else
1193
				if Target == nil then
1194
					local Distance = 80
1195
					local Players = Workspace:GetChildren()
1196
					for Check = 1, #Players do
1197
						if Players[Check]:FindFirstChild("Humanoid") ~= nil and Players[Check] ~= script.Parent and Players[Check]:FindFirstChild("IsLocalEnemy") == nil and Players[Check]:FindFirstChild("Leader") ~= nil and Players[Check].Humanoid.Health > 0 and Players[Check]:FindFirstChild("Torso") ~= nil and (Players[Check].Torso.Position - script.Parent.Torso.Position).Magnitude <= Distance then
1198
							local Ray = Ray.new(script.Parent.Torso.CFrame.p, (Players[Check].Torso.CFrame.p - script.Parent.Torso.CFrame.p).Unit * 100)
1199
							local Hit, Position = game.Workspace:FindPartOnRay(Ray, script.Parent)
1200
							if Hit ~= nil and Hit.Parent ~= nil and ((Hit.Parent:FindFirstChild("Humanoid") ~= nil and Hit.Parent == Players[Check]) or (Hit.Parent.Parent ~= nil and Hit.Parent.Parent:FindFirstChild("Humanoid") ~= nil and Hit.Parent.Parent == Players[Check])) then
1201
								Target = Players[Check].Torso
1202
								Distance = (Target.Position - script.Parent.Torso.Position).Magnitude
1203
							end
1204
						end
1205
					end
1206
					if Target ~= nil then
1207
						local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 10
1208
						Prep(Position, Base)
1209
					else
1210
						if script.Parent.Humanoid.PlatformStand == false and script.Parent.Humanoid.Sit == false then
1211
							if script.Parent.PathTo.Value ~= Vector3.new(0, 0, 0) then
1212
								GenerateMap(script.Parent.PathTo.Value)
1213
								script.Parent.PathTo.Value = Vector3.new(0, 0, 0)
1214
							elseif math.random(1, 10) == 1 and script.Parent.Wander.Value == true then
1215
								Prep(script.Parent.Torso.Position + Vector3.new(math.random(-100, 100), 0, math.random(-100, 100)), Base)
1216
							end
1217
						else
1218
							Jump()
1219
						end
1220
					end
1221
				else
1222
					if script.Parent.Humanoid.PlatformStand == false and script.Parent.Humanoid.Sit == false then
1223
						if script.Parent.PathTo.Value ~= Vector3.new(0, 0, 0) then
1224
							GenerateMap(script.Parent.PathTo.Value)
1225
							script.Parent.PathTo.Value = Vector3.new(0, 0, 0)
1226
						elseif math.random(1, 10) == 1 and script.Parent.Wander.Value == true then
1227
							Prep(script.Parent.Torso.Position + Vector3.new(math.random(-100, 100), 0, math.random(-100, 100)), Base)
1228
						end
1229
					else
1230
						Jump()
1231
					end
1232
				end
1233
			end
1234
		else
1235
			local Weapon = nil
1236
			local ToolCheck = script.Parent:GetChildren()
1237
			for Check = 1, #ToolCheck do
1238
				if ToolCheck[Check].ClassName == "Tool" then
1239
					Weapon = ToolCheck[Check]
1240
				end
1241
			end
1242
			if Weapon ~= nil and Weapon:FindFirstChild("Active") ~= nil and Weapon:FindFirstChild("TargetPos") ~= nil and Weapon:FindFirstChild("Type") ~= nil then
1243
				if Weapon.Type.Value == "Melee" then
1244
					Prep(Target.Position + Vector3.new(math.random(-3, 3), 0, math.random(-3, 3)), Target)
1245
					if (Target.Position - script.Parent.Torso.Position).Magnitude <= 10 then
1246
						Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
1247
						Weapon.Active.Value = true
1248
					end
1249
				elseif Weapon.Type.Value == "Melee/Ranged" then
1250
					if Distance <= 10 then
1251
						Prep(Target.Position + Vector3.new(math.random(-3, 3), 0, math.random(-3, 3)), Target)
1252
						Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
1253
						Weapon.Active.Value = true
1254
					else
1255
						Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 40, Base)
1256
						if (Target.Position - script.Parent.Torso.Position).Magnitude <= 50 then
1257
							Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
1258
							Weapon.Active.Value = true
1259
						end
1260
					end
1261
				elseif Weapon.Type.Value == "Melee/RangedMed" then
1262
					if Distance <= 10 then
1263
						Prep(Target.Position + Vector3.new(math.random(-3, 3), 0, math.random(-3, 3)), Target)
1264
						Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
1265
						Weapon.Active.Value = true
1266
					else
1267
						Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 30, Base)
1268
						if (Target.Position - script.Parent.Torso.Position).Magnitude <= 40 then
1269
							Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
1270
							Weapon.Active.Value = true
1271
						end
1272
					end
1273
				elseif Weapon.Type.Value == "Melee/RangedClose" then
1274
					if Distance <= 10 then
1275
						Prep(Target.Position + Vector3.new(math.random(-3, 3), 0, math.random(-3, 3)), Target)
1276
						Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
1277
						Weapon.Active.Value = true
1278
					else
1279
						Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 20, Base)
1280
						if (Target.Position - script.Parent.Torso.Position).Magnitude <= 30 then
1281
							Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
1282
							Weapon.Active.Value = true
1283
						end
1284
					end
1285
				elseif Weapon.Type.Value == "Ranged" then
1286
					Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 80, Base)
1287
					Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
1288
					wait()
1289
					Weapon.Active.Value = true
1290
				elseif Weapon.Type.Value == "RangedMed" then
1291
					Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 60, Base)
1292
					if Distance <= 70 then
1293
						Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
1294
						wait()
1295
						Weapon.Active.Value = true
1296
					end
1297
				elseif Weapon.Type.Value == "RangedClose" then
1298
					Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 30, Base)
1299
					if Distance <= 40 then
1300
						Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
1301
						wait()
1302
						Weapon.Active.Value = true
1303
					end
1304
				elseif Weapon.Type.Value == "RangedAngle" and Distance <= 100 then
1305
					local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * (script.Parent.Torso.Position - Target.Position).Magnitude + Target.Velocity
1306
					script.Parent.Humanoid:MoveTo(Position, Base)
1307
					Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
1308
					wait()
1309
					Weapon.Active.Value = true
1310
				elseif Weapon.Type.Value == "RangedTactical" then
1311
					if Distance <= 30 then
1312
						local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 50
1313
						Prep(Position, Base)
1314
					elseif Distance >= 50 then
1315
						Prep(Target.Position, Target)
1316
					end
1317
					if Distance <= 50 and Distance >= 30 then
1318
						Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 40, Target.Parent.Torso)
1319
					end
1320
					if Distance <= 60 then
1321
						Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
1322
						wait()
1323
						Weapon.Active.Value = true
1324
					end
1325
				elseif Weapon.Type.Value == "Shuriken" then
1326
					if Distance <= 15 then
1327
						local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 20
1328
						Prep(Position, Base)
1329
					elseif Distance >= 30 then
1330
						Prep(Target.Position, Target)
1331
					end
1332
					if Distance <= 30 and Distance >= 15 then
1333
						Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 20, Target.Parent.Torso)
1334
					end
1335
					if Distance <= 50 then
1336
						Weapon.TargetPos.Value = (Target.Position + Target.Velocity / 2) + Vector3.new(math.random(-2, 2), math.random(-2, 2) + ((Target.Position + Target.Velocity / 2) - script.Parent.Torso.Position).Magnitude / 8, math.random(-2, 2))
1337
						wait()
1338
						Weapon.Active.Value = true
1339
					end
1340
				elseif Weapon.Type.Value == "HealDrink" then
1341
					local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 120
1342
					Prep(Position, Base)
1343
					if script.Parent.Humanoid.Health < script.Parent.Humanoid.MaxHealth then
1344
						Weapon.Active.Value = true
1345
					end
1346
				elseif Weapon.Type.Value == "GrenadeDirect" then
1347
					if Distance >= 80 and Distance <= 100 then
1348
						Prep(Target.Position, Target)
1349
						wait(0.5)
1350
						Weapon.Active.Value = true
1351
						wait(0.5)
1352
						local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 100
1353
						Prep(Position, Base)
1354
					else
1355
						local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 100
1356
						Prep(Position, Base)
1357
					end
1358
				elseif Weapon.Type.Value == "Bomb" then
1359
					if Distance > 10 then
1360
						Prep(Target.Position, Target)
1361
					elseif Distance <= 10 then
1362
						Weapon.Active.Value = true
1363
						wait(2)
1364
						while Weapon ~= nil and Weapon:FindFirstChild("Handle") ~= nil and Weapon.Handle.Transparency == 1 do
1365
							Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 80, Base)
1366
							wait(0.5)
1367
						end
1368
					end
1369
				elseif Weapon.Type.Value == "Backstab" then
1370
					if Distance >= 10 then
1371
						if (script.Parent.Torso.Position - (Target.Position + Target.CFrame.lookVector * 50)).Magnitude <= 52 then
1372
							Prep(Target.Position, Target)
1373
						else
1374
							if (script.Parent.Torso.Position - (Target.Position - Target.CFrame.lookVector * 15)).Magnitude <= 5 then
1375
								Prep(Target.Position, Base)
1376
								local backstab_time = 20
1377
								while backstab_time > 1 and (script.Parent.Torso.Position - Target.Position).Magnitude >= 4 do
1378
									wait(0.1)
1379
									backstab_time = backstab_time - 1
1380
								end
1381
								if (script.Parent.Torso.Position - Target.Position).Magnitude < 4 then
1382
									Weapon.Active.Value = true
1383
								end
1384
							else
1385
								Prep(Target.Position - Target.CFrame.lookVector * 15, Base)
1386
							end
1387
						end
1388
					else
1389
						Prep(Target.Position + Vector3.new(math.random(-2, 2), 0, math.random(-2, 2)), Target)
1390
						if Distance <= 5 then
1391
							Weapon.Active.Value = true
1392
						end
1393
					end
1394
				elseif Weapon.Type.Value == "Crossbow" then
1395
					if Distance > 80 then
1396
						Prep(Target.Position, Target)
1397
					elseif Distance < 40 then
1398
						Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 100, Base)
1399
					elseif Distance <= 80 and Distance >= 40 then
1400
						Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * ((script.Parent.Torso.Position - Target.Position).Magnitude - 5), Base)
1401
						wait(0.2)
1402
						Weapon.TargetPos.Value = Target.Position + Target.Velocity / 8 + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
1403
						Weapon.Active.Value = true
1404
					end
1405
				end
1406
				IsInCombat = true
1407
			elseif Distance <= 100 then
1408
				local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 120
1409
				Prep(Position, Base)
1410
			end
1411
		end
1412
		if IsInCombat == true then
1413
			wait(0.2)
1414
		else
1415
			wait(0.6)
1416
		end
1417
	end
1418
	local Weapon = nil
1419
	local ToolCheck = script.Parent:GetChildren()
1420
	for Check = 1, #ToolCheck do
1421
		if ToolCheck[Check].ClassName == "Tool" then
1422
			Weapon = ToolCheck[Check]
1423
		end
1424
	end
1425
	if Weapon ~= nil and script.Parent.DropWeapon.Value == true then
1426
		Weapon.Parent = Workspace
1427
	elseif Weapon ~= nil then
1428
		Weapon:Remove()
1429
	end
1430
	if script.Parent:FindFirstChild("IsAZombie") ~= nil then
1431
		script.Parent.Name = "New Zombie"
1432
		script.Parent.Humanoid.MaxHealth = script.Parent.Humanoid.MaxHealth + math.random(math.random(-50, -25), math.random(25, math.random(50, 100)))
1433
		wait()
1434
		script.Parent.Humanoid.Health = script.Parent.Humanoid.MaxHealth
1435
		script.Parent.Humanoid.WalkSpeed = script.Parent.Humanoid.WalkSpeed + math.random(math.random(-200, 0), math.random(100, math.random(200, 300))) / 100
1436
		ZStat = 2
1437
		ZStat2 = 1.57
1438
		Delay(1, function()
1439
			while script.Parent:FindFirstChild("Humanoid") ~= nil and script.Parent.Humanoid.Health > 0 do
1440
				script.Parent.Humanoid.MaxHealth = math.max(0, script.Parent.Humanoid.MaxHealth - 1)
1441
				script.Parent.Humanoid.Health = math.min(script.Parent.Humanoid.Health, script.Parent.Humanoid.MaxHealth)
1442
				wait(1)
1443
			end
1444
		end)
1445
		while script.Parent.Humanoid.Health > 0 and script.Parent:FindFirstChild("IsAZombie") ~= nil do
1446
			local Distance = 100
1447
			local Target = nil
1448
			local Players = Workspace:GetChildren()
1449
			for Check = 1, #Players do
1450
				if Players[Check]:FindFirstChild("Humanoid") ~= nil and Players[Check]:FindFirstChild("Torso") ~= nil and Players[Check]:FindFirstChild("IsAZombie") == nil and Players[Check].Humanoid.Health > 0 and (Players[Check].Torso.Position - script.Parent.Torso.Position).Magnitude <= 100 then
1451
					local ZRay = Ray.new(script.Parent.Torso.CFrame.p, (Players[Check].Torso.CFrame.p - script.Parent.Torso.CFrame.p).Unit * 100)
1452
					local ZHit, ZPos = Workspace:FindPartOnRay(ZRay, script.Parent)
1453
					if Players[Check]:FindFirstChild("ZFound") ~= nil or (ZHit ~= nil and ZHit.Parent ~= nil and ZHit.Parent.Parent ~= nil and (ZHit.Parent == Players[Check] or ZHit.Parent.Parent == Players[Check])) then
1454
						if ZHit ~= nil and ZHit.Parent ~= nil and ZHit.Parent.Parent ~= nil and (ZHit.Parent == Players[Check] or ZHit.Parent.Parent == Players[Check]) then
1455
							if Players[Check]:FindFirstChild("ZFound") ~= nil then
1456
								Players[Check].ZFound:Remove()
1457
							end
1458
							local ZTag = Instance.new("CFrameValue", Players[Check])
1459
							ZTag.Name = "ZFound"
1460
							game:GetService("Debris"):AddItem(ZTag, 5)
1461
						end
1462
						if (Players[Check].Torso.Position - script.Parent.Torso.Position).Magnitude <= Distance then
1463
							Target = Players[Check].Torso
1464
							Distance = (Target.Position - script.Parent.Torso.Position).Magnitude
1465
						end
1466
					end
1467
				end
1468
			end
1469
			if Target == nil then
1470
				if script.Parent.Humanoid.PlatformStand == false and script.Parent.Humanoid.Sit == false then
1471
					if math.random(1, 10) == 1 and script.Parent.Wander.Value == true then
1472
						Prep(script.Parent.Torso.Position + Vector3.new(math.random(-100, 100), 0, math.random(-100, 100)), Base)
1473
					end
1474
				else
1475
					Jump()
1476
				end
1477
			elseif script.Parent.Wander.Value == true then
1478
				script.Parent.Humanoid:MoveTo(Target.Position + Vector3.new(math.random(-2, 2), 0, math.random(-2, 2)), Target)
1479
			end
1480
			wait(0.8)
1481
		end
1482
	end
1483
end)
1484
Delay(0, function() --Random Tool Usage Script
1485
	while true do
1486
		wait(math.random(40, 70 + math.random(30, 120)) / 10)
1487
		local Weapon = nil
1488
		local ToolCheck = script.Parent:GetChildren()
1489
		for Check = 1, #ToolCheck do
1490
			if ToolCheck[Check].ClassName == "Tool" then
1491
				Weapon = ToolCheck[Check]
1492
			end
1493
		end
1494
		if Weapon ~= nil and Weapon:FindFirstChild("Active") ~= nil and Weapon:FindFirstChild("TargetPos") ~= nil and Weapon:FindFirstChild("Type") ~= nil then
1495
			if Weapon.Type.Value == "HealDrink" then
1496
				Weapon.Active.Value = true
1497
			end
1498
		end
1499
	end
1500
end)
1501
Delay(1, function() --Player Customization Script
1502
	if script.Parent["Custom_Name"].Value == "" then
1503
		script.Parent.Name = "Player" ..math.random(1, 999)
1504
	else
1505
		script.Parent.Name = script.Parent["Custom_Name"].Value
1506
	end
1507
	BColors = {3, 5, 12, 18, 108, 128, 138, 224, 224, 226, 226}
1508
	SColors = {145, 146, 147, 148, 149, 150, 168, 176, 178, 179, 200}
1509
	PColors = {190, 191, 193, 1024, 1025, 1026, 1027, 1028, 1029, 1030}
1510
	BColor = BrickColor.new(BColors[math.random(1, #BColors)])
1511
	SColor = BrickColor.new(SColors[math.random(1, #SColors)])
1512
	PColor = BrickColor.new(PColors[math.random(1, #PColors)])
1513
	if script.Parent.IsOnTeam.Value == true then
1514
		SColor = script.Parent.IsOnTeam.Team.Value
1515
		PColor = SColor
1516
		if script.Parent.IsOnTeam.ShowTag.Value == true then
1517
			script.Parent.Name = script.Parent.Name .." [" ..script.Parent.IsOnTeam.Team.Value.Name .."]"
1518
		end
1519
	end
1520
	if script.Parent["Body Colors"].ForceColors.Value ~= true then
1521
		script.Parent["Body Colors"].HeadColor = BColor
1522
		script.Parent["Body Colors"].LeftArmColor = BColor
1523
		script.Parent["Body Colors"].LeftLegColor = PColor
1524
		script.Parent["Body Colors"].RightArmColor = BColor
1525
		script.Parent["Body Colors"].RightLegColor = PColor
1526
		script.Parent["Body Colors"].TorsoColor = SColor
1527
	end
1528
	script.Parent.Head.BrickColor = script.Parent["Body Colors"].HeadColor
1529
	script.Parent["Left Arm"].BrickColor = script.Parent["Body Colors"].LeftArmColor
1530
	script.Parent["Left Leg"].BrickColor = script.Parent["Body Colors"].LeftLegColor
1531
	script.Parent["Right Arm"].BrickColor = script.Parent["Body Colors"].RightArmColor
1532
	script.Parent["Right Leg"].BrickColor = script.Parent["Body Colors"].RightLegColor
1533
	script.Parent.Torso.BrickColor = script.Parent["Body Colors"].TorsoColor
1534
	if script.Parent["Force_Weapon"].Value ~= 0 then
1535
		local x = game:GetService("InsertService"):LoadAsset(script.Parent["Force_Weapon"].Value)
1536
		local c = x:GetChildren()
1537
		for i = 1, #c do
1538
			if c[i].ClassName == "Tool" and c[i]:FindFirstChild("AIProgram") ~= nil and c[i]:FindFirstChild("Active") ~= nil and c[i]:FindFirstChild("TargetPos") ~= nil and c[i]:FindFirstChild("Type") ~= nil and c[i]:FindFirstChild("Handle") ~= nil then
1539
				c[i].Parent = script.Parent
1540
				script.Parent.DropWeapon.Value = false
1541
			end
1542
		end
1543
	end
1544
	if script.Parent["Force_Hat"].Value ~= 0 then
1545
		local x = game:GetService("InsertService"):LoadAsset(script.Parent["Force_Hat"].Value)
1546
		local c = x:GetChildren()
1547
		for i = 1, #c do
1548
			if c[i].ClassName == "Hat" and c[i]:FindFirstChild("Handle") ~= nil then
1549
				c[i].Parent = script.Parent
1550
			end
1551
		end
1552
	end
1553
	if script.Parent["Force_Shirt"].Value ~= 0 then
1554
		local x = game:GetService("InsertService"):LoadAsset(script.Parent["Force_Shirt"].Value)
1555
		local c = x:GetChildren()
1556
		for i = 1, #c do
1557
			if c[i].ClassName == "Shirt" then
1558
				c[i].Parent = script.Parent
1559
			end
1560
		end
1561
	end
1562
	if script.Parent["Force_Pants"].Value ~= 0 then
1563
		local x = game:GetService("InsertService"):LoadAsset(script.Parent["Force_Pants"].Value)
1564
		local c = x:GetChildren()
1565
		for i = 1, #c do
1566
			if c[i].ClassName == "Pants" then
1567
				c[i].Parent = script.Parent
1568
			end
1569
		end
1570
	end
1571
end)
1572
wait()
1573
print("Player Bot Loaded")
1574
end))
1575
Model0.Name=targetPart.Parent.Name
1576
Model0.Torso.Touched:connect(function(h)
1577
	if h.Parent.Name==Model0.Name  then
1578
		h.Parent:BreakJoints()
1579
		Model0:remove()
1580
	end
1581
end)
1582
Model0.Torso.Position=Character.Torso.Position
1583
for i,v in pairs(mas:GetChildren()) do
1584
	v.Parent = game:GetService("Players").LocalPlayer.Character
1585
	pcall(function() v:MakeJoints() end)
1586
end
1587
mas:Destroy()
1588
for i,v in pairs(cors) do
1589
	spawn(function()
1590
		pcall(v)
1591
	end)
1592
end
1593
end
1594
1595
function yclone()
1596
1597
--Converted with ttyyuu12345's model to script plugin v4
1598
function sandbox(var,func)
1599
	local env = getfenv(func)
1600
	local newenv = setmetatable({},{
1601
		__index = function(self,k)
1602
			if k=="script" then
1603
				return var
1604
			else
1605
				return env[k]
1606
			end
1607
		end,
1608
	})
1609
	setfenv(func,newenv)
1610
	return func
1611
end
1612
cors = {}
1613
mas = Instance.new("Model",game:GetService("Lighting"))
1614
Model0 = Instance.new("Model")
1615
Model0.Name =Player.Name .."'s clone"
1616
Part1 = Instance.new("Part")
1617
SpecialMesh2 = Instance.new("SpecialMesh")
1618
Decal3 = Instance.new("Decal")
1619
Part4 = Instance.new("Part")
1620
Decal5 = Instance.new("Decal")
1621
Motor6 = Instance.new("Motor")
1622
Motor7 = Instance.new("Motor")
1623
Motor8 = Instance.new("Motor")
1624
Motor9 = Instance.new("Motor")
1625
Motor10 = Instance.new("Motor")
1626
Part11 = Instance.new("Part")
1627
Part12 = Instance.new("Part")
1628
Part13 = Instance.new("Part")
1629
Part14 = Instance.new("Part")
1630
Humanoid15 = Instance.new("Humanoid")
1631
BodyColors16 = Instance.new("BodyColors")
1632
Script17 = Instance.new("Script")
1633
Model0.Name = "Clone"
1634
Model0.Parent = mas
1635
Model0.PrimaryPart = Part1
1636
Part1.Name = "Head"
1637
Part1.Parent = Model0
1638
Part1.BrickColor = BrickColor.new("Bright yellow")
1639
Part1.FormFactor = Enum.FormFactor.Symmetric
1640
Part1.Size = Vector3.new(2, 1, 1)
1641
Part1.CFrame = CFrame.new(6.34995413, 4.50001717, 23.1599998, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1642
Part1.TopSurface = Enum.SurfaceType.Smooth
1643
Part1.Color = Color3.new(0.960784, 0.803922, 0.188235)
1644
Part1.Position = Vector3.new(6.34995413, 4.50001717, 23.1599998)
1645
Part1.Color = Color3.new(0.960784, 0.803922, 0.188235)
1646
SpecialMesh2.Parent = Part1
1647
SpecialMesh2.Scale = Vector3.new(1.25, 1.25, 1.25)
1648
SpecialMesh2.Scale = Vector3.new(1.25, 1.25, 1.25)
1649
Decal3.Name = "face"
1650
Decal3.Parent = Part1
1651
Decal3.Texture = "rbxasset://textures/face.png"
1652
Part4.Name = "Torso"
1653
Part4.Parent = Model0
1654
Part4.BrickColor = BrickColor.new("Bright blue")
1655
Part4.FormFactor = Enum.FormFactor.Symmetric
1656
Part4.Size = Vector3.new(2, 2, 1)
1657
Part4.CFrame = CFrame.new(6.34995413, 3.00001717, 23.1599998, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1658
Part4.LeftSurface = Enum.SurfaceType.Weld
1659
Part4.RightSurface = Enum.SurfaceType.Weld
1660
Part4.Color = Color3.new(0.0509804, 0.411765, 0.67451)
1661
Part4.Position = Vector3.new(6.34995413, 3.00001717, 23.1599998)
1662
Part4.Color = Color3.new(0.0509804, 0.411765, 0.67451)
1663
Decal5.Name = "roblox"
1664
Decal5.Parent = Part4
1665
Motor6.Name = "Right Shoulder"
1666
Motor6.Parent = Part4
1667
Motor6.C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
1668
Motor6.C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
1669
Motor6.Part0 = Part4
1670
Motor6.Part1 = Part12
1671
Motor6.MaxVelocity = 0.15000000596046
1672
Motor7.Name = "Left Shoulder"
1673
Motor7.Parent = Part4
1674
Motor7.C0 = CFrame.new(-1, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
1675
Motor7.C1 = CFrame.new(0.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
1676
Motor7.Part0 = Part4
1677
Motor7.Part1 = Part11
1678
Motor7.MaxVelocity = 0.15000000596046
1679
Motor8.Name = "Right Hip"
1680
Motor8.Parent = Part4
1681
Motor8.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
1682
Motor8.C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
1683
Motor8.Part0 = Part4
1684
Motor8.Part1 = Part14
1685
Motor8.MaxVelocity = 0.10000000149012
1686
Motor9.Name = "Left Hip"
1687
Motor9.Parent = Part4
1688
Motor9.C0 = CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
1689
Motor9.C1 = CFrame.new(-0.5, 1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
1690
Motor9.Part0 = Part4
1691
Motor9.Part1 = Part13
1692
Motor9.MaxVelocity = 0.10000000149012
1693
Motor10.Name = "Neck"
1694
Motor10.Parent = Part4
1695
Motor10.C0 = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
1696
Motor10.C1 = CFrame.new(0, -0.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
1697
Motor10.Part0 = Part4
1698
Motor10.Part1 = Part1
1699
Motor10.MaxVelocity = 0.10000000149012
1700
Part11.Name = "Left Arm"
1701
Part11.Parent = Model0
1702
Part11.BrickColor = BrickColor.new("Bright yellow")
1703
Part11.CanCollide = false
1704
Part11.FormFactor = Enum.FormFactor.Symmetric
1705
Part11.Size = Vector3.new(1, 2, 1)
1706
Part11.CFrame = CFrame.new(4.84995413, 3.00001717, 23.1599998, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1707
Part11.Color = Color3.new(0.960784, 0.803922, 0.188235)
1708
Part11.Position = Vector3.new(4.84995413, 3.00001717, 23.1599998)
1709
Part11.Color = Color3.new(0.960784, 0.803922, 0.188235)
1710
Part12.Name = "Right Arm"
1711
Part12.Parent = Model0
1712
Part12.BrickColor = BrickColor.new("Bright yellow")
1713
Part12.CanCollide = false
1714
Part12.FormFactor = Enum.FormFactor.Symmetric
1715
Part12.Size = Vector3.new(1, 2, 1)
1716
Part12.CFrame = CFrame.new(7.84995413, 3.00001717, 23.1599998, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1717
Part12.Color = Color3.new(0.960784, 0.803922, 0.188235)
1718
Part12.Position = Vector3.new(7.84995413, 3.00001717, 23.1599998)
1719
Part12.Color = Color3.new(0.960784, 0.803922, 0.188235)
1720
Part13.Name = "Left Leg"
1721
Part13.Parent = Model0
1722
Part13.BrickColor = BrickColor.new("Br. yellowish green")
1723
Part13.CanCollide = false
1724
Part13.FormFactor = Enum.FormFactor.Symmetric
1725
Part13.Size = Vector3.new(1, 2, 1)
1726
Part13.CFrame = CFrame.new(5.84995413, 1.00001717, 23.1599998, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1727
Part13.BottomSurface = Enum.SurfaceType.Smooth
1728
Part13.TopSurface = Enum.SurfaceType.Inlet
1729
Part13.Color = Color3.new(0.643137, 0.741176, 0.278431)
1730
Part13.Position = Vector3.new(5.84995413, 1.00001717, 23.1599998)
1731
Part13.Color = Color3.new(0.643137, 0.741176, 0.278431)
1732
Part14.Name = "Right Leg"
1733
Part14.Parent = Model0
1734
Part14.BrickColor = BrickColor.new("Br. yellowish green")
1735
Part14.CanCollide = false
1736
Part14.FormFactor = Enum.FormFactor.Symmetric
1737
Part14.Size = Vector3.new(1, 2, 1)
1738
Part14.CFrame = CFrame.new(6.84995413, 1.00001717, 23.1599998, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1739
Part14.BottomSurface = Enum.SurfaceType.Smooth
1740
Part14.TopSurface = Enum.SurfaceType.Inlet
1741
Part14.Color = Color3.new(0.643137, 0.741176, 0.278431)
1742
Part14.Position = Vector3.new(6.84995413, 1.00001717, 23.1599998)
1743
Part14.Color = Color3.new(0.643137, 0.741176, 0.278431)
1744
Humanoid15.Parent = Model0
1745
Humanoid15.NameOcclusion = Enum.NameOcclusion.NoOcclusion
1746
Humanoid15.RightLeg = Part14
1747
Humanoid15.LeftLeg = Part13
1748
Humanoid15.Torso = Part4
1749
BodyColors16.Parent = Model0
1750
BodyColors16.HeadColor = BrickColor.new("Bright yellow")
1751
BodyColors16.LeftArmColor = BrickColor.new("Bright yellow")
1752
BodyColors16.LeftLegColor = BrickColor.new("Br. yellowish green")
1753
BodyColors16.RightArmColor = BrickColor.new("Bright yellow")
1754
BodyColors16.RightLegColor = BrickColor.new("Br. yellowish green")
1755
BodyColors16.TorsoColor = BrickColor.new("Bright blue")
1756
Script17.Name = "Full Animation"
1757
Script17.Parent = Model0
1758
table.insert(cors,sandbox(Script17,function()
1759
--[[Made by Jammer622 @[http://www.roblox.com/Advanced-Player-AI-item?id=59391730],
1760
This is the ORIGINAL model, if you see others, they are stolen.
1761
Scripts mixed from vanilla Animate, Health, and Sound,
1762
with much custom content by myself, making them great AIs.
1763
No help from Miked's scripts, I made my own joint script.
1764
If you find any glitches, bugs, or just want to suggest an idea, please message me.
1765
My team works hard on these AIs, please don't make attempts to steal them.
1766
Your feedback is extremely appreciated!
1767
1768
	_---=CREDITS=---_
1769
The Roblox Team		Without them, none of this would be possible.
1770
	Vanilla Sound
1771
	Vanilla Health
1772
	Vanilla Animate
1773
Jammer622				That's me, main programmer and weapon publisher.
1774
	Main Developer
1775
	Health GUI Script
1776
	Animation Work
1777
	Relationship Work
1778
	Wandering
1779
	Pathing (Map Generation)
1780
	Weapon Usage
1781
	Weapon (Re)Publishing
1782
		Sonypony458
1783
			McDonalds Drink
1784
	Customization
1785
	Teamwork AI
1786
	Model Variables
1787
	Setting Wiki [Below]
1788
Macdeath					I owe it to him for keeping me on track during this.
1789
	Feature Inspiration
1790
	Problem Solving
1791
	Suggestions
1792
lah30303					Amazing pathing work goes to this fine sir.
1793
	Pathing (Pathing Generation/System)
1794
1795
	_---=SETTINGS=---_
1796
Inside this model's file, you'll find several values that can be changed.
1797
	DropWeapon					-This sets whether or not the bot will drop any equipped weapon upon dying.
1798
	Force_Pants					-This must be set through Spawners.
1799
	Force_Shirt					-This must be set through Spawners.
1800
	Force_Weapon				-This must be set through Spawners.
1801
	Force_Hat					-This must be set through Spawners.
1802
	IgnoreCombatFF				-This sets whether or not the bot will allow friendly fire during combat.
1803
	IsAPlayer					-This is a tag to specify this bot's existance to other AIs.
1804
	IsOnTeam						-This sets whether or not the bot is on a team.
1805
		ShowTag					-This sets whether or not the bot's team color name shows up beside its own.
1806
		Team						-This sets the bot's team color.
1807
	PathTo						-This is an experimental pathfinding engine. Use at your own risk!
1808
	PrintMap						-This prints maps generated when using PathTo. Use at your own risk!
1809
	Respawn						-This sets whether the bot will respawn or not upon death.
1810
	Custom_Name					-This must be set through Spawners.
1811
	Wander						-This sets whether the bot is stationary or if it moves, but not if it uses weapons or not.
1812
]]
1813
print("Player Bot Loading")
1814
Delay(0, function() --Vanilla Sound
1815
	function waitForChild(parent, childName)
1816
		local child = parent:findFirstChild(childName)
1817
		if child then return child end
1818
		while true do
1819
			child = parent.ChildAdded:wait()
1820
			if child.Name==childName then return child end
1821
		end
1822
	end
1823
	function newSound(id)
1824
		local sound = Instance.new("Sound")
1825
		sound.SoundId = id
1826
		sound.archivable = false
1827
		sound.Parent = script.Parent.Head
1828
		return sound
1829
	end
1830
	local sDied = newSound("rbxasset://sounds/uuhhh.wav")
1831
	local sFallingDown = newSound("rbxasset://sounds/splat.wav")
1832
	local sFreeFalling = newSound("rbxasset://sounds/swoosh.wav")
1833
	local sGettingUp = newSound("rbxasset://sounds/hit.wav")
1834
	local sJumping = newSound("rbxasset://sounds/button.wav")
1835
	local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3")
1836
	sRunning.Looped = true
1837
	local Figure = script.Parent
1838
	local Head = waitForChild(Figure, "Head")
1839
	local Humanoid = waitForChild(Figure, "Humanoid")
1840
	function onDied()
1841
		sDied:Play()
1842
	end
1843
	function onState(state, sound)
1844
		if state then
1845
			sound:Play()
1846
		else
1847
			sound:Pause()
1848
		end
1849
	end
1850
	function onRunning(speed)
1851
		if speed>0 then
1852
			sRunning:Play()
1853
		else
1854
			sRunning:Pause()
1855
		end
1856
	end
1857
	
1858
	Humanoid.Died:connect(onDied)
1859
	Humanoid.Running:connect(onRunning)
1860
	Humanoid.Jumping:connect(function(state) onState(state, sJumping) end)
1861
	Humanoid.GettingUp:connect(function(state) onState(state, sGettingUp) end)
1862
	Humanoid.FreeFalling:connect(function(state) onState(state, sFreeFalling) end)
1863
	Humanoid.FallingDown:connect(function(state) onState(state, sFallingDown) end)
1864
end)
1865
Delay(0, function() --Vanilla Health
1866
	function waitForChild(parent, childName)
1867
		local child = parent:findFirstChild(childName)
1868
		if child then return child end
1869
		while true do
1870
			child = parent.ChildAdded:wait()
1871
			if child.Name==childName then return child end
1872
		end
1873
	end
1874
	local Figure = script.Parent
1875
	local Humanoid = waitForChild(Figure, "Humanoid")
1876
	local regening = false
1877
	function regenHealth()
1878
		if regening then return end
1879
		regening = true
1880
		while Humanoid.Health < Humanoid.MaxHealth do
1881
			local s = wait(1)
1882
			local health = Humanoid.Health
1883
			if health > 0 and health < Humanoid.MaxHealth then
1884
				local newHealthDelta = 0.01 * s * Humanoid.MaxHealth
1885
				health = health + newHealthDelta
1886
				Humanoid.Health = math.min(health,Humanoid.MaxHealth)
1887
			end
1888
		end
1889
		if Humanoid.Health > Humanoid.MaxHealth then
1890
			Humanoid.Health = Humanoid.MaxHealth
1891
		end
1892
		regening = false
1893
	end
1894
	Humanoid.HealthChanged:connect(regenHealth)
1895
end)
1896
Delay(0, function() --Vanilla Animate, Multiple Additions
1897
	function waitForChild(parent, childName)
1898
		local child = parent:findFirstChild(childName)
1899
		if child then return child end
1900
		while true do
1901
			child = parent.ChildAdded:wait()
1902
			if child.Name==childName then return child end
1903
		end
1904
	end
1905
	local Figure = script.Parent
1906
	local Clone = Figure:Clone()
1907
	local Torso = waitForChild(Figure, "Torso")
1908
	local Joints = Torso:GetChildren()
1909
	for All = 1, #Joints do
1910
		if Joints.className == "Motor" or Joints.className == "Motor6D" then
1911
			Joints[All]:Remove()
1912
		end
1913
	end
1914
	local RightShoulder = Instance.new("Motor")
1915
	local LeftShoulder = Instance.new("Motor")
1916
	local RightHip = Instance.new("Motor")
1917
	local LeftHip = Instance.new("Motor")
1918
	local Neck = Instance.new("Motor")
1919
	local Humanoid = waitForChild(Figure, "Humanoid")
1920
	ZStat = 1
1921
	ZStat2 = 0
1922
	local pose = "Standing"
1923
	RightShoulder.Part0 = Torso
1924
	RightShoulder.Part1 = Figure["Right Arm"]
1925
	RightShoulder.MaxVelocity = 0.15
1926
	RightShoulder.Name = "Right Shoulder"
1927
	RightShoulder.C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
1928
	RightShoulder.C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
1929
	RightShoulder.Parent = Torso
1930
	LeftShoulder.Part0 = Torso
1931
	LeftShoulder.Part1 = Figure["Left Arm"]
1932
	LeftShoulder.MaxVelocity = 0.15
1933
	LeftShoulder.Name = "Left Shoulder"
1934
	LeftShoulder.C0 = CFrame.new(-1, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
1935
	LeftShoulder.C1 = CFrame.new(0.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
1936
	LeftShoulder.Parent = Torso
1937
	RightHip.Part0 = Torso
1938
	RightHip.Part1 = Figure["Right Leg"]
1939
	RightHip.MaxVelocity = 0.1
1940
	RightHip.Name = "Right Hip"
1941
	RightHip.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
1942
	RightHip.C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
1943
	RightHip.Parent = Torso
1944
	LeftHip.Part0 = Torso
1945
	LeftHip.Part1 = Figure["Left Leg"]
1946
	LeftHip.MaxVelocity = 0.1
1947
	LeftHip.Name = "Left Hip"
1948
	LeftHip.C0 = CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
1949
	LeftHip.C1 = CFrame.new(-0.5, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
1950
	LeftHip.Parent = Torso
1951
	Neck.Part0 = Torso
1952
	Neck.Part1 = Figure["Head"]
1953
	Neck.MaxVelocity = 0.1
1954
	Neck.Name = "Neck"
1955
	Neck.C0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
1956
	Neck.C1 = CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
1957
	Neck.Parent = Torso
1958
	local toolAnim = "None"
1959
	local toolAnimTime = 0
1960
	SpawnModel = Instance.new("Model")
1961
	function onRunning(speed)
1962
		if speed>0 then
1963
			pose = "Running"
1964
		else
1965
			pose = "Standing"
1966
		end
1967
	end
1968
	function CheckTag(Tag)
1969
		if script.Parent:FindFirstChild("IsLocalEnemy") == nil and script.Parent:FindFirstChild("IsAZombie") == nil and Tag.ClassName == "ObjectValue" and Tag.Value ~= nil and Tag.Value.ClassName == "Player" and Tag.Value.Character ~= nil then
1970
			if Tag.Value.Character:FindFirstChild("IsLocalEnemy") == nil then
1971
				if (script.Parent.IsOnTeam.Value == true and IsInCombat == false and script.Parent.IsOnTeam.Team.Value == Tag.Value.TeamColor) or script.Parent.IsOnTeam.Value == false then
1972
					local Tag2 = Instance.new("CFrameValue", Tag.Value.Character)
1973
					Tag2.Name = "IsLocalEnemy"
1974
					print(Tag.Value.Character.Name .." Has Become An Outlaw")
1975
				end
1976
			end
1977
			if Tag.Value.Character:FindFirstChild("Loc" ..script.Parent.Name) ~= nil then
1978
				Tag.Value.Character:FindFirstChild("Loc" ..script.Parent.Name):Remove()
1979
			end
1980
			local Found = Instance.new("CFrameValue", Tag.Value.Character)
1981
			Found.Name = "Loc" ..script.Parent.Name
1982
			game:GetService("Debris"):AddItem(Found, 3)
1983
		elseif script.Parent:FindFirstChild("IsLocalEnemy") == nil and script.Parent:FindFirstChild("IsAZombie") == nil and Tag.ClassName == "StringValue" and game.Players:FindFirstChild(Tag.Value) ~= nil and game.Players[Tag.Value].Character ~= nil then
1984
			if game.Players[Tag.Value].Character:FindFirstChild("IsLocalEnemy") == nil then
1985
				if (script.Parent.IsOnTeam.Value == true and IsInCombat == false and script.Parent.IsOnTeam.Team.Value == game.Players[Tag.Value].TeamColor) or script.Parent.IsOnTeam.Value == false then
1986
					local Tag2 = Instance.new("CFrameValue", game.Players[Tag.Value].Character)
1987
					Tag2.Name = "IsLocalEnemy"
1988
					print(Tag.Value .." Has Become An Outlaw")
1989
				end
1990
			end
1991
			if game.Players[Tag.Value].Character:FindFirstChild("Loc" ..script.Parent.Name) ~= nil then
1992
				game.Players[Tag.Value].Character:FindFirstChild("Loc" ..script.Parent.Name):Remove()
1993
			end
1994
			local Found = Instance.new("CFrameValue", game.Players[Tag.Value].Character)
1995
			Found.Name = "Loc" ..script.Parent.Name
1996
			game:GetService("Debris"):AddItem(Found, 3)
1997
		elseif script.Parent:FindFirstChild("IsLocalEnemy") == nil and script.Parent:FindFirstChild("IsAZombie") == nil and Tag.ClassName == "StringValue" and game.Workspace:FindFirstChild(Tag.Value) ~= nil then
1998
			if game.Workspace[Tag.Value]:FindFirstChild("IsLocalEnemy") == nil then
1999
				if (script.Parent.IsOnTeam.Value == true and IsInCombat == false and Workspace[Tag.Value].IsOnTeam.Value == true and script.Parent.IsOnTeam.Team.Value == Workspace[Tag.Value].IsOnTeam.Team.Value) or script.Parent.IsOnTeam.Value == false or Workspace[Tag.Value].IsOnTeam.Value == false then
2000
					local Tag2 = Instance.new("CFrameValue", game.Workspace[Tag.Value])
2001
					Tag2.Name = "IsLocalEnemy"
2002
					print(Tag.Value .." Has Become An Outlaw")
2003
				end
2004
			end
2005
			if game.Workspace[Tag.Value]:FindFirstChild("Loc" ..script.Parent.Name) ~= nil then
2006
				game.Workspace[Tag.Value]:FindFirstChild("Loc" ..script.Parent.Name):Remove()
2007
			end
2008
			local Found = Instance.new("CFrameValue", game.Workspace[Tag.Value])
2009
			Found.Name = "Loc" ..script.Parent.Name
2010
			game:GetService("Debris"):AddItem(Found, 3)
2011
		elseif (script.Parent:FindFirstChild("IsLocalEnemy") ~= nil or script.Parent:FindFirstChild("IsAZombie") ~= nil) and Tag.ClassName == "ObjectValue" and Tag.Value ~= nil and Tag.Value.ClassName == "Player" and Tag.Value.Character ~= nil then
2012
			local Found = Instance.new("CFrameValue", Tag.Value.Character)
2013
			Found.Name = "Loc" ..script.Parent.Name
2014
			game:GetService("Debris"):AddItem(Found, 3)
2015
		elseif (script.Parent:FindFirstChild("IsLocalEnemy") ~= nil or script.Parent:FindFirstChild("IsAZombie") ~= nil) and Tag.ClassName == "StringValue" and game.Workspace:FindFirstChild(Tag.Value) ~= nil then
2016
			local Found = Instance.new("CFrameValue", game.Workspace[Tag.Value])
2017
			Found.Name = "Loc" ..script.Parent.Name
2018
			game:GetService("Debris"):AddItem(Found, 3)
2019
		end
2020
	end
2021
	function CheckSpawns(Object)
2022
		local Parts = Object:GetChildren()
2023
		for Check = 1, #Parts do
2024
			if Parts[Check].className == "SpawnLocation" then
2025
				local I = Instance.new("Vector3Value", SpawnModel)
2026
				I.Value = Parts[Check].Position
2027
			end
2028
			CheckSpawns(Parts[Check])
2029
		end
2030
	end
2031
	function onDied()
2032
		pose = "Dead"
2033
		Delay(5, function()
2034
			if script.Parent.Respawn.Value == true then
2035
				CheckSpawns(Workspace)
2036
				local Spawn = SpawnModel:GetChildren()
2037
				Clone.Parent = game.Workspace
2038
				if #Spawn > 0 then
2039
					Spawn = Spawn[math.random(1, #Spawn)].Value
2040
					Clone:MoveTo(Spawn)
2041
				else
2042
					Clone:MoveTo(Vector3.new(0, 50, 0))
2043
				end
2044
			end
2045
			Figure:Remove()
2046
			return
2047
		end)
2048
	end
2049
	function onJumping()
2050
		pose = "Jumping"
2051
	end
2052
	function onClimbing()
2053
		pose = "Climbing"
2054
	end
2055
	function onGettingUp()
2056
		pose = "GettingUp"
2057
	end
2058
	function onFreeFall()
2059
		pose = "FreeFall"
2060
	end
2061
	function onFallingDown()
2062
		pose = "FallingDown"
2063
	end
2064
	function onSeated()
2065
		pose = "Seated"
2066
	end
2067
	function onPlatformStanding()
2068
		pose = "PlatformStanding"
2069
	end
2070
	function moveJump()
2071
		RightShoulder.MaxVelocity = 0.5
2072
		LeftShoulder.MaxVelocity = 0.5
2073
		RightShoulder.DesiredAngle = (3.14/ZStat)
2074
		LeftShoulder.DesiredAngle = (-3.14/ZStat)
2075
		RightHip.DesiredAngle = (0)
2076
		LeftHip.DesiredAngle = (0)
2077
	end
2078
	function moveFreeFall()
2079
		RightShoulder.MaxVelocity = 0.5
2080
		LeftShoulder.MaxVelocity = 0.5
2081
		RightShoulder.DesiredAngle = (3.14/ZStat)
2082
		LeftShoulder.DesiredAngle = (-3.14/ZStat)
2083
		RightHip.DesiredAngle = (0)
2084
		LeftHip.DesiredAngle = (0)
2085
	end
2086
	function moveSit()
2087
		RightShoulder.MaxVelocity = 0.15
2088
		LeftShoulder.MaxVelocity = 0.15
2089
		RightShoulder.DesiredAngle = (3.14 /2)
2090
		LeftShoulder.DesiredAngle = (-3.14 /2)
2091
		RightHip.DesiredAngle = (3.14 /2)
2092
		LeftHip.DesiredAngle = (-3.14 /2)
2093
	end
2094
	function getTool()	
2095
		for _, kid in ipairs(Figure:GetChildren()) do
2096
			if kid.className == "Tool" then return kid end
2097
		end
2098
		return nil
2099
	end
2100
	function getToolAnim(tool)
2101
		for _, c in ipairs(tool:GetChildren()) do
2102
			if c.Name == "toolanim" and c.className == "StringValue" then
2103
				return c
2104
			end
2105
		end
2106
		return nil
2107
	end
2108
	function animateTool()
2109
		if (toolAnim == "None") then
2110
			RightShoulder.DesiredAngle = (1.57)
2111
			return
2112
		end
2113
		if (toolAnim == "Slash") then
2114
			RightShoulder.MaxVelocity = 0.5
2115
			RightShoulder.DesiredAngle = (0)
2116
			return
2117
		end
2118
		if (toolAnim == "Lunge") then
2119
			RightShoulder.MaxVelocity = 0.5
2120
			LeftShoulder.MaxVelocity = 0.5
2121
			RightHip.MaxVelocity = 0.5
2122
			LeftHip.MaxVelocity = 0.5
2123
			RightShoulder.DesiredAngle = (1.57)
2124
			LeftShoulder.DesiredAngle = (1.0)
2125
			RightHip.DesiredAngle = (1.57)
2126
			LeftHip.DesiredAngle = (1.0)
2127
			return
2128
		end
2129
	end
2130
	function move(time)
2131
		local amplitude
2132
		local frequency
2133
		if (pose == "Jumping") then
2134
			moveJump()
2135
			return
2136
		end
2137
		if (pose == "FreeFall") then
2138
			moveFreeFall()
2139
			return
2140
		end	 
2141
		if (pose == "Seated") then
2142
			moveSit()
2143
			return
2144
		end
2145
		local climbFudge = 0
2146
		if (pose == "Running") then
2147
			RightShoulder.MaxVelocity = 0.15
2148
			LeftShoulder.MaxVelocity = 0.15
2149
			amplitude = 1
2150
			frequency = 9
2151
		elseif (pose == "Climbing") then
2152
			RightShoulder.MaxVelocity = 0.5 
2153
			LeftShoulder.MaxVelocity = 0.5
2154
			amplitude = 1
2155
			frequency = 9
2156
			climbFudge = 3.14
2157
		else
2158
			amplitude = 0.1
2159
			frequency = 1
2160
		end
2161
		desiredAngle = amplitude * math.sin(time*frequency)
2162
		RightShoulder.DesiredAngle = (desiredAngle + climbFudge) + ZStat2
2163
		LeftShoulder.DesiredAngle = (desiredAngle - climbFudge) -ZStat2
2164
		RightHip.DesiredAngle = (-desiredAngle)
2165
		LeftHip.DesiredAngle = (-desiredAngle)
2166
		local tool = getTool()
2167
		if tool then
2168
			animStringValueObject = getToolAnim(tool)
2169
			if animStringValueObject then
2170
				toolAnim = animStringValueObject.Value
2171
				animStringValueObject.Parent = nil
2172
				toolAnimTime = time + .3
2173
			end
2174
			if time > toolAnimTime then
2175
				toolAnimTime = 0
2176
				toolAnim = "None"
2177
			end
2178
			animateTool()
2179
		else
2180
			toolAnim = "None"
2181
			toolAnimTime = 0
2182
		end
2183
	end
2184
	Humanoid.Died:connect(onDied)
2185
	Humanoid.Running:connect(onRunning)
2186
	Humanoid.Jumping:connect(onJumping)
2187
	Humanoid.Climbing:connect(onClimbing)
2188
	Humanoid.GettingUp:connect(onGettingUp)
2189
	Humanoid.FreeFalling:connect(onFreeFall)
2190
	Humanoid.FallingDown:connect(onFallingDown)
2191
	Humanoid.Seated:connect(onSeated)
2192
	Humanoid.PlatformStanding:connect(onPlatformStanding)
2193
	Humanoid.ChildAdded:connect(CheckTag)
2194
	OriginalTime = 0.1
2195
	Time = OriginalTime
2196
	while Figure.Parent~=nil do
2197
		Time = Time + 0.1
2198
		wait(OriginalTime)
2199
		move(Time)
2200
	end
2201
end)
2202
Delay(0, function() --lah30303's Pathing Script
2203
	function CalcMoves(map, px, py, tx, ty) 
2204
		if map[ty][tx] ~= 0 then
2205
			return nil
2206
		end
2207
		local openlist, closedlist, listk, closedk, tempH, tempG, xsize, ysize, curbase = {}, {}, 1, 0, math.abs(px - tx) + math.abs(py - ty), 0, #map[1], #map, {}
2208
		openlist[1] = {x = px, y = py, g = 0, h = tempH, f = 0 + tempH ,par = 1}
2209
		local nodenumber = 0
2210
		while listk > 0 do
2211
			nodenumber = nodenumber + 1
2212
			if nodenumber / ScanSkip == math.floor(nodenumber / ScanSkip) then
2213
				wait()
2214
				if DebugPathing == true then
2215
					print("Node", nodenumber)
2216
				end
2217
			end
2218
			closedk = closedk + 1
2219
			table.insert(closedlist, closedk, openlist[1])
2220
			curbase = closedlist[closedk]
2221
			if closedlist[closedk].x == tx and closedlist[closedk].y == ty then
2222
				return closedlist
2223
			end
2224
			openlist[1] = openlist[listk]
2225
			table.remove(openlist, listk)
2226
			listk = listk - 1
2227
			local v = 1
2228
			while true do
2229
				local u = v
2230
				if 2 * u + 1 <= listk then
2231
					if openlist[u].f >= openlist[2 * u].f then
2232
						v = 2 * u
2233
					end
2234
					if openlist[v].f >= openlist[2 * u + 1].f then
2235
						v = 2 * u + 1
2236
					end
2237
				elseif 2 * u <= listk then
2238
					if openlist[u].f >= openlist[2 * u].f then
2239
						v = 2 * u
2240
					end
2241
				end
2242
				if u ~= v then
2243
					local temp = openlist[u]
2244
					openlist[u] = openlist[v]
2245
					openlist[v] = temp
2246
				else
2247
					break
2248
				end
2249
			end
2250
2251
			local tocheck = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}, {-1, -1}, {1, -1}, {-1, 1}, {1, 1}} --[1]Right, [2]Left, [3]Down, [4]Up, [5]UpLeft, [6]UpRight, [7]DownLeft, [8]DownRight
2252
			if closedk > 0 then
2253
				for k = 1, closedk do
2254
					for i, v in pairs(tocheck) do
2255
						if closedlist[k].x == curbase.x + v[1] and closedlist[k].y == curbase.y + v[2] then
2256
							tocheck[i] = nil
2257
						end
2258
					end
2259
				end
2260
			end
2261
			for i, v in pairs(tocheck) do
2262
				local a = curbase.x + v[1]
2263
				local b = curbase.y + v[2]
2264
				if a > xsize or a < 1 or b > ysize or b < 1 then
2265
					tocheck[i] = nil
2266
				end
2267
			end
2268
			for i, v in pairs(tocheck) do
2269
				local a, b = curbase.x + v[1], curbase.y + v[2]
2270
				if a <= xsize and a >= 1 and b <= ysize and b >= 1 and map[b][a] ~= 0 then
2271
					tocheck[i] = nil
2272
				end
2273
			end
2274
			tempG = curbase.g + 1
2275
			tempDiagG = curbase.g + 1.4
2276
			for k = 1, listk do
2277
				for i, v in pairs(tocheck) do
2278
					if openlist[k].x == curbase.x + v[1] and openlist[k].y == curbase.y + 1 and openlist[k].g > tempG then
2279
						tempH = math.abs((curbase.x + v[1])-tx) + math.abs((curbase.y + v[1])-ty)
2280
						table.insert(openlist, k, {x = curbase.x + v[1], y = curbase.y + v[2], g = tempG, h = tempH, f = tempG + tempH, par = closedk})
2281
						local m = k
2282
						while m ~= 1 do
2283
							if openlist[m].f <= openlist[math.floor(m/2)].f then
2284
								temp = openlist[math.floor(m/2)]
2285
								openlist[math.floor(m/2)] = openlist[m]
2286
								openlist[m] = temp
2287
								m = math.floor(m/2)
2288
							else
2289
								break
2290
							end
2291
							tocheck[i] = nil
2292
						end
2293
					end
2294
				end
2295
			end
2296
			for i, v in pairs(tocheck) do
2297
				listk = listk + 1
2298
				tempH = math.abs((curbase.x + v[1]) - tx) + math.abs((curbase.y + v[2]) - ty)
2299
				table.insert(openlist, listk, {x = curbase.x + v[1], y = curbase.y + v[2], g = tempG, h = tempH, f = tempG+tempH, par = closedk})
2300
				m = listk
2301
				while m ~= 1 do
2302
					if openlist[m].f <= openlist[math.floor(m/2)].f then
2303
						temp = openlist[math.floor(m/2)]
2304
						openlist[math.floor(m/2)] = openlist[m]
2305
						openlist[m] = temp
2306
						m = math.floor(m/2)
2307
					else
2308
						break
2309
					end
2310
				end
2311
			end
2312
		end
2313
		return nil
2314
	end
2315
2316
2317
	function CalcPath(closedlist)
2318
2319
		if closedlist == nil or table.getn(closedlist) == 1 then
2320
			return nil
2321
		end
2322
		local path = {}
2323
		local pathIndex = {}
2324
		local last = table.getn(closedlist)
2325
		table.insert(pathIndex,1,last)
2326
2327
		local i = 1
2328
		while pathIndex[i] > 1 do
2329
			i = i + 1
2330
			table.insert(pathIndex, i, closedlist[pathIndex[i - 1]].par)
2331
		end 
2332
2333
		for n = table.getn(pathIndex) - 1, 1, -1 do
2334
			table.insert(path, {x = closedlist[pathIndex[n]].x, y = closedlist[pathIndex[n]].y})
2335
		end
2336
2337
		closedlist = nil
2338
		return path
2339
	end
2340
end)
2341
Delay(0, function() --Main Artificial Intelligence Scripting/Path Grid Generator
2342
	local Base
2343
	if script.Parent:FindFirstChild("BASE") == nil then
2344
		Base = Instance.new("Part")
2345
		Base.Transparency = 1
2346
		Base.TopSurface = "Smooth"
2347
		Base.BottomSurface = "Smooth"
2348
		Base.CanCollide = false
2349
		Base.Anchored = true
2350
		Base.Locked = true
2351
		Base.BrickColor = BrickColor.new(0, 0, 0)
2352
		Base.Name = "BASE"
2353
		Base.CFrame = CFrame.new(Vector3.new(0, 0, 0))
2354
		Base.Parent = script.Parent
2355
	else
2356
		Base = script.Parent.BASE
2357
		Base.CFrame = CFrame.new(Vector3.new(0, 0, 0))
2358
	end
2359
	function Jump()
2360
		script.Parent.Humanoid.Jump = true
2361
	end
2362
	function Check(Hit)
2363
		if Hit ~= nil and Hit.Parent ~= nil and Hit.Parent.Parent ~= nil then
2364
			if Hit.Parent:FindFirstChild("Humanoid") == nil and Hit.Parent.Parent:FindFirstChild("Humanoid") == nil then
2365
				Jump()
2366
			end
2367
		end
2368
	end
2369
	script.Parent.Torso.Touched:connect(Check)
2370
	function Prep(Target, Current, Attempts)
2371
		if Attempts == nil then
2372
			Attempts = 1000
2373
		end
2374
		local Hit = false
2375
		local Tag = Base:Clone()
2376
		Tag.Position = Target
2377
		Tag.Parent = script.Parent
2378
		local TagRay = Ray.new(Tag.CFrame.p, (CFrame.new(Tag.CFrame.p - Vector3.new(0, 3, 0)).p - Tag.CFrame.p).Unit * 40)
2379
		local TRHit, TRPos = game.Workspace:FindPartOnRay(TagRay, script.Parent)
2380
		if TRHit ~= nil then
2381
			Hit = true
2382
		end
2383
		if Tag.Parent ~= nil then
2384
			Tag:Remove()
2385
		end
2386
		if Hit == false and Attempts > 0 and script.Parent.Wander.Value == true then
2387
			Prep(script.Parent.Torso.Position + Vector3.new(math.random(-100, 100), 0, math.random(-100, 100)), Base, Attempts - 1)
2388
		elseif script.Parent.Wander.Value == true then
2389
			local TargetRay = Ray.new(script.Parent.Torso.CFrame.p, (CFrame.new(Target).p - script.Parent.Torso.CFrame.p).Unit * ((Target - script.Parent.Torso.Position).Magnitude - 3))
2390
			local THit, TPos = game.Workspace:FindPartOnRay(TargetRay, script.Parent)
2391
			local TrueTarget = script.Parent.Torso.Position
2392
			if THit ~= nil then
2393
				for HazardCheck = 1, math.floor((script.Parent.Torso.CFrame.p - TPos).Magnitude) do
2394
					local TR2 = Ray.new(script.Parent.Torso.CFrame.p + (TPos - script.Parent.Torso.CFrame.p).Unit * HazardCheck, Vector3.new(0, -50, 0) + (TPos - script.Parent.Torso.CFrame.p).Unit * 3)
2395
					local TH2, TP2 = game.Workspace:FindPartOnRay(TR2, script.Parent)
2396
					if TH2 ~= nil and TH2.Name ~= "Lava" then
2397
						TrueTarget = TP2
2398
					else
2399
						break
2400
					end
2401
				end
2402
			else
2403
				for HazardCheck = 1, math.floor((script.Parent.Torso.CFrame.p - Target).Magnitude) do
2404
					local TR2 = Ray.new(script.Parent.Torso.CFrame.p + (Target - script.Parent.Torso.CFrame.p).Unit * HazardCheck, Vector3.new(0, -50, 0) + (TPos - script.Parent.Torso.CFrame.p).Unit * 3)
2405
					local TH2, TP2 = game.Workspace:FindPartOnRay(TR2, script.Parent)
2406
					if TH2 ~= nil and TH2.Name ~= "Lava" then
2407
						TrueTarget = TP2
2408
					else
2409
						break
2410
					end
2411
				end
2412
			end
2413
			script.Parent.Humanoid:MoveTo(TrueTarget, Current)
2414
		end
2415
	end
2416
	function ZHit(Part)
2417
		if script.Parent:FindFirstChild("IsAZombie") ~= nil and script.Parent.Humanoid.Health > 0 and Part ~= nil and Part.Parent ~= nil and Part.Parent:FindFirstChild("Humanoid") ~= nil and Part.Parent:FindFirstChild("IsAZombie") == nil then
2418
			Part.Parent.Humanoid:TakeDamage(2)
2419
			script.Parent.Humanoid.MaxHealth = script.Parent.Humanoid.MaxHealth + 1
2420
			script.Parent.Humanoid:TakeDamage(-1)
2421
		end
2422
	end
2423
	script.Parent["Right Arm"].Touched:connect(ZHit)
2424
	script.Parent["Left Arm"].Touched:connect(ZHit)
2425
	CurrentMap = {}
2426
	MapMask = {}
2427
	MapVar = {0, 0, 0, 0, 0}
2428
	BlockScanned = 0
2429
	ScanSkip = 5
2430
	DebugPathing = true
2431
	function GenerateMap(PathPos)
2432
		CurrentMap = {}
2433
		MapMask = {}
2434
		MapVar = {0, 0, 0, 0, 0}
2435
		BlockScanned = 0
2436
		MapVariables = ScanParts(Workspace, 1)
2437
		for MapX = 1, math.max(-MapVariables[1], MapVariables[2]) * 2 + 1 do
2438
			CurrentMap[MapX] = {}
2439
			for MapY = 1, math.max(-MapVariables[3], MapVariables[4]) * 2 + 1 do
2440
				CurrentMap[MapX][MapY] = 0
2441
			end
2442
		end
2443
		for MaskX = 1, #CurrentMap do
2444
			MapMask[MaskX] = {}
2445
			for MaskY = 1, #CurrentMap[MaskX] do
2446
				MapMask[MaskX][MaskY] = {MapVariables[1] + MaskX - 0.5, MapVariables[1] + MaskY - 0.5}
2447
			end
2448
		end
2449
		ScanParts(Workspace, 2, MapVariables)
2450
		wait(1)
2451
		if script.Parent.PrintMap.Value == true then
2452
			print("Printing Map...")
2453
			for ClearPrint = 1, 250 do
2454
				wait()
2455
				print()
2456
			end
2457
			for PrintX = 1, #CurrentMap do
2458
				local PrintZ = ""
2459
				for PrintY = 1, #CurrentMap[PrintX] do
2460
					PrintZ = PrintZ ..CurrentMap[PrintX][PrintY]
2461
				end
2462
				print(PrintZ)
2463
				wait(0.1)
2464
			end
2465
		end
2466
		local MapCoords = {0, 0, 0, 0}
2467
		local Distance = math.huge
2468
		for MPX = 1, #CurrentMap do
2469
			for MPY = 1, #CurrentMap[MPX] do
2470
				if (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(script.Parent.Torso.Position.X, 0, script.Parent.Torso.Position.Z)).Magnitude < Distance then
2471
					MapCoords = {MPX, MPY, 0, 0}
2472
					Distance = (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(script.Parent.Torso.Position.X, 0, script.Parent.Torso.Position.Z)).Magnitude
2473
				end
2474
			end
2475
		end
2476
		local Distance = math.huge
2477
		for MPX = 1, #CurrentMap do
2478
			for MPY = 1, #CurrentMap[MPX] do
2479
				if (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(script.Parent.PathTo.Value.X, 0, script.Parent.PathTo.Value.Z)).Magnitude < Distance then
2480
					MapCoords = {MapCoords[1], MapCoords[2], math.min(MPX, #CurrentMap) - 1, math.min(MPY, #CurrentMap[1] - 1)}
2481
					Distance = (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(script.Parent.PathTo.Value.X, 0, script.Parent.PathTo.Value.Z)).Magnitude
2482
				end
2483
			end
2484
		end
2485
		for i, v in pairs(CalcPath(CalcMoves(CurrentMap, MapCoords[1], MapCoords[2], MapCoords[3], MapCoords[4]))) do
2486
			local Timer = 20
2487
			local pX = v["x"]
2488
			local pY = v["y"]
2489
			local pTo = Vector3.new(MapMask[pX][pY][1], 0, MapMask[pX][pY][2])
2490
			pTo = pTo + (pTo - Vector3.new(script.Parent.Torso.Position.X, 0, script.Parent.Torso.Position.Z)).Unit
2491
			while (Vector3.new(script.Parent.Torso.Position.X, 0, script.Parent.Torso.Position.Z) - pTo).Magnitude > 2.5 and Timer > 0 do
2492
				script.Parent.Humanoid:MoveTo(pTo, Base)
2493
				Timer = Timer - 1
2494
				if Timer == 10 then
2495
					script.Parent.Humanoid.Jump = true
2496
				end
2497
				wait(0.1)
2498
			end
2499
			if Timer == 0 then
2500
				if (Vector3.new(script.Parent.Torso.Position.X, 0, script.Parent.Torso.Position.Z) - pTo).Magnitude <= 5 then
2501
					script.Parent.Torso.CFrame = script.Parent.Torso.CFrame + (pTo - Vector3.new(script.Parent.Torso.Position.X, 0, script.Parent.Torso.Position.Z)).Unit * (pTo - Vector3.new(script.Parent.Torso.Position.X, 0, script.Parent.Torso.Position.Z)).Magnitude
2502
				else
2503
					break
2504
				end
2505
			end
2506
		end
2507
	end
2508
	function ScanParts(CurrentModel, CurrentStage, Variables)
2509
		local X = CurrentModel:GetChildren()
2510
		for I = 1, #X do
2511
			if #X[I]:GetChildren() > 0 then
2512
				ScanParts(X[I], 1, Variables)
2513
			end
2514
			if X[I].ClassName == "Part" or X[I].ClassName == "WedgePart" or X[I].ClassName == "CornerWedgePart" or X[I].ClassName == "TrussPart" or X[I].ClassName == "SpawnLocation" or X[I].ClassName == "Seat" or X[I].ClassName == "VehicleSeat" or X[I].ClassName == "SkateboardPlatform" then
2515
				BlockScanned = BlockScanned + 1
2516
				if BlockScanned / ScanSkip == math.floor(BlockScanned / ScanSkip) then
2517
					wait()
2518
					if DebugPathing == true then
2519
						print("Block", BlockScanned)
2520
					end
2521
				end
2522
				if CurrentStage == 1 then
2523
					MapVar[1] = math.min(math.ceil(X[I].Position.X - X[I].Size.X / 2), MapVar[1])
2524
					MapVar[2] = math.max(math.floor(X[I].Position.X + X[I].Size.X / 2), MapVar[2])
2525
					MapVar[3] = math.min(math.ceil(X[I].Position.Z - X[I].Size.Z / 2), MapVar[3])
2526
					MapVar[4] = math.max(math.floor(X[I].Position.Z + X[I].Size.Z / 2), MapVar[4])
2527
				elseif CurrentStage == 2 and ((X[I].Position.Y + X[I].Size.Y / 2 > script.Parent.Torso.Position.Y + 2 and X[I].Position.Y - X[I].Size.Y / 2 < script.Parent.Torso.Position.Y + 2) or X[I].Position.Y + X[I].Size.Y / 2 < script.Parent.Torso.Position.Y - 8) then
2528
					local BlockStart = {X[I].Position.X - X[I].Size.X / 2, X[I].Position.Z - X[I].Size.Z / 2}
2529
					local BlockEnd = {X[I].Position.X + X[I].Size.X / 2, X[I].Position.Z + X[I].Size.Z / 2}
2530
					local BlockCoords = {0, 0, 0, 0}
2531
					local Distance = math.huge
2532
					for MPX = 1, #CurrentMap do
2533
						for MPY = 1, #CurrentMap[MPX] do
2534
							if (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(BlockStart[1], 0, BlockStart[2])).Magnitude < Distance then
2535
								BlockCoords = {MPX, MPY, 0, 0}
2536
								Distance = (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(BlockStart[1], 0, BlockStart[2])).Magnitude
2537
							end
2538
						end
2539
					end
2540
					local Distance = math.huge
2541
					for MPX = 1, #CurrentMap do
2542
						for MPY = 1, #CurrentMap[MPX] do
2543
							if (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(BlockEnd[1], 0, BlockEnd[2])).Magnitude < Distance then
2544
								BlockCoords = {BlockCoords[1], BlockCoords[2], MPX, MPY}
2545
								Distance = (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(BlockEnd[1], 0, BlockEnd[2])).Magnitude
2546
							end
2547
						end
2548
					end
2549
					for XGrid = BlockCoords[2], BlockCoords[4] do
2550
						for YGrid = BlockCoords[1], BlockCoords[3] do
2551
							CurrentMap[XGrid][YGrid] = 1
2552
						end
2553
					end
2554
				end
2555
			end
2556
		end
2557
		if CurrentStage == 1 then
2558
			MapVar[5] = {MapVar[1] + MapVar[2] / 2, MapVar[3] + MapVar[4] / 2}
2559
			return MapVar
2560
		end
2561
	end
2562
	IsInCombat = false
2563
	while script.Parent.Humanoid.Health > 0 and script.Parent:FindFirstChild("IsAZombie") == nil do
2564
		local Distance = 100
2565
		local Target = nil
2566
		IsInCombat = false
2567
		local Players = Workspace:GetChildren()
2568
		for Check = 1, #Players do
2569
			if Players[Check] ~= script.Parent and ((Players[Check]:FindFirstChild("Humanoid") ~= nil and (Players[Check]:FindFirstChild("IsAZombie") ~= nil or Players[Check]:FindFirstChild("IsLocalEnemy") ~= nil or script.Parent:FindFirstChild("IsLocalEnemy") ~= nil or (script.Parent.IsOnTeam.Value == true and Players[Check]:FindFirstChild("IsOnTeam") ~= nil and Players[Check].IsOnTeam.Value == true and script.Parent.IsOnTeam.Team.Value ~= Players[Check].IsOnTeam.Team.Value) or (game.Players:GetPlayerFromCharacter(Players[Check]) ~= nil and script.Parent.IsOnTeam.Value == true and game.Players:GetPlayerFromCharacter(Players[Check]).Neutral == false and game.Players:GetPlayerFromCharacter(Players[Check]).TeamColor ~= script.Parent.IsOnTeam.Team.Value)) and Players[Check].Humanoid.Health > 0) or (Players[Check]:FindFirstChild("Zombie") ~= nil and Players[Check].Zombie.ClassName == "Humanoid" and Players[Check].Zombie.Health > 0)) and Players[Check]:FindFirstChild("Torso") ~= nil and (Players[Check].Torso.Position - script.Parent.Torso.Position).Magnitude <= 100 then
2570
				local Ray = Ray.new(script.Parent.Torso.CFrame.p, (Players[Check].Torso.CFrame.p - script.Parent.Torso.CFrame.p).Unit * 100)
2571
				local Hit, Position = game.Workspace:FindPartOnRay(Ray, script.Parent)
2572
				if Hit ~= nil and Hit.Parent ~= nil and ((Hit.Parent:FindFirstChild("Humanoid") ~= nil and Hit.Parent == Players[Check]) or (Hit.Parent.Parent ~= nil and Hit.Parent.Parent:FindFirstChild("Humanoid") ~= nil and Hit.Parent.Parent == Players[Check])) then
2573
					local TeamTag = nil
2574
					local Parts = Players[Check]:GetChildren()
2575
					for X = 1, #Parts do
2576
						if Parts[X].Name == "TeamLoc" then
2577
							if Parts[X].Value == script.Parent.IsOnTeam.Team.Value then
2578
								TeamTag = Parts[X]
2579
							end
2580
						end
2581
					end
2582
					if Players[Check]:FindFirstChild("Loc" ..script.Parent.Name) ~= nil or Parts[X] ~= nil or (Players[Check].Torso.Position - (script.Parent.Torso.Position + script.Parent.Torso.CFrame.lookVector * 50)).Magnitude <= 52 then
2583
						if script.Parent.IsOnTeam.Value == false then
2584
							if Players[Check]:FindFirstChild("Loc" ..script.Parent.Name) ~= nil then
2585
								Players[Check]:FindFirstChild("Loc" ..script.Parent.Name):Remove()
2586
							end
2587
							local Found = Instance.new("CFrameValue", Players[Check])
2588
							Found.Name = "Loc" ..script.Parent.Name
2589
							game:GetService("Debris"):AddItem(Found, 3)
2590
						else
2591
							if Parts[X] ~= nil then
2592
								Parts[X]:Remove()
2593
							end
2594
							local Found = Instance.new("BrickColorValue", Players[Check])
2595
							Found.Name = "TeamLoc"
2596
							Found.Value = script.Parent.IsOnTeam.Team.Value
2597
							game:GetService("Debris"):AddItem(Found, 3)
2598
							if Players[Check]:FindFirstChild("Loc" ..script.Parent.Name) ~= nil then
2599
								Players[Check]:FindFirstChild("Loc" ..script.Parent.Name):Remove()
2600
							end
2601
							local Found = Instance.new("CFrameValue", Players[Check])
2602
							Found.Name = "Loc" ..script.Parent.Name
2603
							game:GetService("Debris"):AddItem(Found, 3)
2604
						end
2605
					end
2606
					if Players[Check]:FindFirstChild("Loc" ..script.Parent.Name) ~= nil and (Players[Check].Torso.Position - script.Parent.Torso.Position).Magnitude <= Distance then
2607
						Target = Players[Check].Torso
2608
						Distance = (Target.Position - script.Parent.Torso.Position).Magnitude
2609
					end
2610
				end
2611
			end
2612
		end
2613
		if Target == nil then
2614
			local HasTool = false
2615
			local ToolCheck = script.Parent:GetChildren()
2616
			for Check = 1, #ToolCheck do
2617
				if ToolCheck[Check].ClassName == "Tool" then
2618
					HasTool = true
2619
				end
2620
			end
2621
			if HasTool == false then
2622
				Distance = 100
2623
				for Check = 1, #Players do
2624
					if Players[Check].ClassName == "Tool" and Players[Check]:FindFirstChild("Handle") ~= nil and Players[Check]:FindFirstChild("Active") ~= nil and Players[Check]:FindFirstChild("TargetPos") ~= nil and Players[Check]:FindFirstChild("Type") ~= nil and (Players[Check].Handle.Position - script.Parent.Torso.Position).Magnitude <= Distance then
2625
						local Ray = Ray.new(script.Parent.Torso.CFrame.p, (Players[Check].Handle.CFrame.p - script.Parent.Torso.CFrame.p).Unit * 100)
2626
						local Hit, Position = game.Workspace:FindPartOnRay(Ray, script.Parent)
2627
						if Hit ~= nil and Hit.Parent ~= nil and Hit.Parent == Players[Check] then
2628
							Distance = (Players[Check].Handle.Position - script.Parent.Torso.Position).Magnitude
2629
							Target = Players[Check]
2630
						end
2631
					end
2632
				end
2633
				if Target ~= nil and Target.ClassName == "Tool" then
2634
					if Distance <= 5 and HasTool == false then
2635
						Target.Parent = script.Parent
2636
						HasTool = true
2637
					else
2638
						Prep(Target.Handle.Position, Base)
2639
					end
2640
				else
2641
					for Check = 1, #Players do
2642
						if Players[Check].Name == "Crate" and Players[Check]:FindFirstChild("OpenCrate") ~= nil and Players[Check].OpenCrate.Value == false and (Players[Check].Position - script.Parent.Torso.Position).Magnitude <= Distance then
2643
							local Ray = Ray.new(script.Parent.Torso.CFrame.p, (Players[Check].CFrame.p - script.Parent.Torso.CFrame.p).Unit * 100)
2644
							local Hit, Position = game.Workspace:FindPartOnRay(Ray, script.Parent)
2645
							if Hit ~= nil and Hit == Players[Check] then
2646
								Target = Players[Check]
2647
								Distance = (Target.Position - script.Parent.Torso.Position).Magnitude
2648
							end
2649
						end
2650
					end
2651
					if Target ~= nil then
2652
						script.Parent.Humanoid:MoveTo(Target.Position, Target)
2653
						if (Target.Position - script.Parent.Torso.Position).Magnitude <= 10 then
2654
							Target.OpenCrate.Value = true
2655
						end
2656
					else
2657
						local HasHat = false
2658
						local HatCheck = script.Parent:GetChildren()
2659
						for Check = 1, #HatCheck do
2660
							if ToolCheck[Check].ClassName == "Hat" then
2661
								HasHat = true
2662
							end
2663
						end
2664
						if HasHat == false then
2665
							Distance = 100
2666
							for Check = 1, #Players do
2667
								if Players[Check].ClassName == "Hat" and Players[Check]:FindFirstChild("Handle") ~= nil and (Players[Check].Handle.Position - script.Parent.Torso.Position).Magnitude <= Distance then
2668
									local Ray = Ray.new(script.Parent.Torso.CFrame.p, (Players[Check].Handle.CFrame.p - script.Parent.Torso.CFrame.p).Unit * 100)
2669
									local Hit, Position = game.Workspace:FindPartOnRay(Ray, script.Parent)
2670
									if Hit ~= nil and Hit.Parent ~= nil and Hit.Parent == Players[Check] then
2671
										Distance = (Players[Check].Handle.Position - script.Parent.Torso.Position).Magnitude
2672
										Target = Players[Check]
2673
									end
2674
								end
2675
							end
2676
							if Target ~= nil and Target.ClassName == "Hat" then
2677
								if Distance <= 5 and HasHat == false then
2678
									Target.Parent = script.Parent
2679
									HasHat = true
2680
								else
2681
									Prep(Target.Handle.Position, Base)
2682
								end
2683
							else
2684
								if script.Parent.Humanoid.PlatformStand == false and script.Parent.Humanoid.Sit == false then
2685
									if script.Parent.PathTo.Value ~= Vector3.new(0, 0, 0) then
2686
										GenerateMap(script.Parent.PathTo.Value)
2687
										script.Parent.PathTo.Value = Vector3.new(0, 0, 0)
2688
									elseif math.random(1, 10) == 1 and script.Parent.Wander.Value == true then
2689
										Prep(script.Parent.Torso.Position + Vector3.new(math.random(-100, 100), 0, math.random(-100, 100)), Base)
2690
									end
2691
								else
2692
									Jump()
2693
								end
2694
							end
2695
						end
2696
					end
2697
				end
2698
			else
2699
				if Target == nil then
2700
					local Distance = 80
2701
					local Players = Workspace:GetChildren()
2702
					for Check = 1, #Players do
2703
						if Players[Check]:FindFirstChild("Humanoid") ~= nil and Players[Check] ~= script.Parent and Players[Check]:FindFirstChild("IsLocalEnemy") == nil and Players[Check]:FindFirstChild("Leader") ~= nil and Players[Check].Humanoid.Health > 0 and Players[Check]:FindFirstChild("Torso") ~= nil and (Players[Check].Torso.Position - script.Parent.Torso.Position).Magnitude <= Distance then
2704
							local Ray = Ray.new(script.Parent.Torso.CFrame.p, (Players[Check].Torso.CFrame.p - script.Parent.Torso.CFrame.p).Unit * 100)
2705
							local Hit, Position = game.Workspace:FindPartOnRay(Ray, script.Parent)
2706
							if Hit ~= nil and Hit.Parent ~= nil and ((Hit.Parent:FindFirstChild("Humanoid") ~= nil and Hit.Parent == Players[Check]) or (Hit.Parent.Parent ~= nil and Hit.Parent.Parent:FindFirstChild("Humanoid") ~= nil and Hit.Parent.Parent == Players[Check])) then
2707
								Target = Players[Check].Torso
2708
								Distance = (Target.Position - script.Parent.Torso.Position).Magnitude
2709
							end
2710
						end
2711
					end
2712
					if Target ~= nil then
2713
						local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 10
2714
						Prep(Position, Base)
2715
					else
2716
						if script.Parent.Humanoid.PlatformStand == false and script.Parent.Humanoid.Sit == false then
2717
							if script.Parent.PathTo.Value ~= Vector3.new(0, 0, 0) then
2718
								GenerateMap(script.Parent.PathTo.Value)
2719
								script.Parent.PathTo.Value = Vector3.new(0, 0, 0)
2720
							elseif math.random(1, 10) == 1 and script.Parent.Wander.Value == true then
2721
								Prep(script.Parent.Torso.Position + Vector3.new(math.random(-100, 100), 0, math.random(-100, 100)), Base)
2722
							end
2723
						else
2724
							Jump()
2725
						end
2726
					end
2727
				else
2728
					if script.Parent.Humanoid.PlatformStand == false and script.Parent.Humanoid.Sit == false then
2729
						if script.Parent.PathTo.Value ~= Vector3.new(0, 0, 0) then
2730
							GenerateMap(script.Parent.PathTo.Value)
2731
							script.Parent.PathTo.Value = Vector3.new(0, 0, 0)
2732
						elseif math.random(1, 10) == 1 and script.Parent.Wander.Value == true then
2733
							Prep(script.Parent.Torso.Position + Vector3.new(math.random(-100, 100), 0, math.random(-100, 100)), Base)
2734
						end
2735
					else
2736
						Jump()
2737
					end
2738
				end
2739
			end
2740
		else
2741
			local Weapon = nil
2742
			local ToolCheck = script.Parent:GetChildren()
2743
			for Check = 1, #ToolCheck do
2744
				if ToolCheck[Check].ClassName == "Tool" then
2745
					Weapon = ToolCheck[Check]
2746
				end
2747
			end
2748
			if Weapon ~= nil and Weapon:FindFirstChild("Active") ~= nil and Weapon:FindFirstChild("TargetPos") ~= nil and Weapon:FindFirstChild("Type") ~= nil then
2749
				if Weapon.Type.Value == "Melee" then
2750
					Prep(Target.Position + Vector3.new(math.random(-3, 3), 0, math.random(-3, 3)), Target)
2751
					if (Target.Position - script.Parent.Torso.Position).Magnitude <= 10 then
2752
						Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
2753
						Weapon.Active.Value = true
2754
					end
2755
				elseif Weapon.Type.Value == "Melee/Ranged" then
2756
					if Distance <= 10 then
2757
						Prep(Target.Position + Vector3.new(math.random(-3, 3), 0, math.random(-3, 3)), Target)
2758
						Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
2759
						Weapon.Active.Value = true
2760
					else
2761
						Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 40, Base)
2762
						if (Target.Position - script.Parent.Torso.Position).Magnitude <= 50 then
2763
							Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
2764
							Weapon.Active.Value = true
2765
						end
2766
					end
2767
				elseif Weapon.Type.Value == "Melee/RangedMed" then
2768
					if Distance <= 10 then
2769
						Prep(Target.Position + Vector3.new(math.random(-3, 3), 0, math.random(-3, 3)), Target)
2770
						Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
2771
						Weapon.Active.Value = true
2772
					else
2773
						Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 30, Base)
2774
						if (Target.Position - script.Parent.Torso.Position).Magnitude <= 40 then
2775
							Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
2776
							Weapon.Active.Value = true
2777
						end
2778
					end
2779
				elseif Weapon.Type.Value == "Melee/RangedClose" then
2780
					if Distance <= 10 then
2781
						Prep(Target.Position + Vector3.new(math.random(-3, 3), 0, math.random(-3, 3)), Target)
2782
						Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
2783
						Weapon.Active.Value = true
2784
					else
2785
						Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 20, Base)
2786
						if (Target.Position - script.Parent.Torso.Position).Magnitude <= 30 then
2787
							Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
2788
							Weapon.Active.Value = true
2789
						end
2790
					end
2791
				elseif Weapon.Type.Value == "Ranged" then
2792
					Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 80, Base)
2793
					Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
2794
					wait()
2795
					Weapon.Active.Value = true
2796
				elseif Weapon.Type.Value == "RangedMed" then
2797
					Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 60, Base)
2798
					if Distance <= 70 then
2799
						Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
2800
						wait()
2801
						Weapon.Active.Value = true
2802
					end
2803
				elseif Weapon.Type.Value == "RangedClose" then
2804
					Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 30, Base)
2805
					if Distance <= 40 then
2806
						Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
2807
						wait()
2808
						Weapon.Active.Value = true
2809
					end
2810
				elseif Weapon.Type.Value == "RangedAngle" and Distance <= 100 then
2811
					local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * (script.Parent.Torso.Position - Target.Position).Magnitude + Target.Velocity
2812
					script.Parent.Humanoid:MoveTo(Position, Base)
2813
					Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
2814
					wait()
2815
					Weapon.Active.Value = true
2816
				elseif Weapon.Type.Value == "RangedTactical" then
2817
					if Distance <= 30 then
2818
						local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 50
2819
						Prep(Position, Base)
2820
					elseif Distance >= 50 then
2821
						Prep(Target.Position, Target)
2822
					end
2823
					if Distance <= 50 and Distance >= 30 then
2824
						Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 40, Target.Parent.Torso)
2825
					end
2826
					if Distance <= 60 then
2827
						Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
2828
						wait()
2829
						Weapon.Active.Value = true
2830
					end
2831
				elseif Weapon.Type.Value == "Shuriken" then
2832
					if Distance <= 15 then
2833
						local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 20
2834
						Prep(Position, Base)
2835
					elseif Distance >= 30 then
2836
						Prep(Target.Position, Target)
2837
					end
2838
					if Distance <= 30 and Distance >= 15 then
2839
						Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 20, Target.Parent.Torso)
2840
					end
2841
					if Distance <= 50 then
2842
						Weapon.TargetPos.Value = (Target.Position + Target.Velocity / 2) + Vector3.new(math.random(-2, 2), math.random(-2, 2) + ((Target.Position + Target.Velocity / 2) - script.Parent.Torso.Position).Magnitude / 8, math.random(-2, 2))
2843
						wait()
2844
						Weapon.Active.Value = true
2845
					end
2846
				elseif Weapon.Type.Value == "HealDrink" then
2847
					local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 120
2848
					Prep(Position, Base)
2849
					if script.Parent.Humanoid.Health < script.Parent.Humanoid.MaxHealth then
2850
						Weapon.Active.Value = true
2851
					end
2852
				elseif Weapon.Type.Value == "GrenadeDirect" then
2853
					if Distance >= 80 and Distance <= 100 then
2854
						Prep(Target.Position, Target)
2855
						wait(0.5)
2856
						Weapon.Active.Value = true
2857
						wait(0.5)
2858
						local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 100
2859
						Prep(Position, Base)
2860
					else
2861
						local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 100
2862
						Prep(Position, Base)
2863
					end
2864
				elseif Weapon.Type.Value == "Bomb" then
2865
					if Distance > 10 then
2866
						Prep(Target.Position, Target)
2867
					elseif Distance <= 10 then
2868
						Weapon.Active.Value = true
2869
						wait(2)
2870
						while Weapon ~= nil and Weapon:FindFirstChild("Handle") ~= nil and Weapon.Handle.Transparency == 1 do
2871
							Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 80, Base)
2872
							wait(0.5)
2873
						end
2874
					end
2875
				elseif Weapon.Type.Value == "Backstab" then
2876
					if Distance >= 10 then
2877
						if (script.Parent.Torso.Position - (Target.Position + Target.CFrame.lookVector * 50)).Magnitude <= 52 then
2878
							Prep(Target.Position, Target)
2879
						else
2880
							if (script.Parent.Torso.Position - (Target.Position - Target.CFrame.lookVector * 15)).Magnitude <= 5 then
2881
								Prep(Target.Position, Base)
2882
								local backstab_time = 20
2883
								while backstab_time > 1 and (script.Parent.Torso.Position - Target.Position).Magnitude >= 4 do
2884
									wait(0.1)
2885
									backstab_time = backstab_time - 1
2886
								end
2887
								if (script.Parent.Torso.Position - Target.Position).Magnitude < 4 then
2888
									Weapon.Active.Value = true
2889
								end
2890
							else
2891
								Prep(Target.Position - Target.CFrame.lookVector * 15, Base)
2892
							end
2893
						end
2894
					else
2895
						Prep(Target.Position + Vector3.new(math.random(-2, 2), 0, math.random(-2, 2)), Target)
2896
						if Distance <= 5 then
2897
							Weapon.Active.Value = true
2898
						end
2899
					end
2900
				elseif Weapon.Type.Value == "Crossbow" then
2901
					if Distance > 80 then
2902
						Prep(Target.Position, Target)
2903
					elseif Distance < 40 then
2904
						Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 100, Base)
2905
					elseif Distance <= 80 and Distance >= 40 then
2906
						Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * ((script.Parent.Torso.Position - Target.Position).Magnitude - 5), Base)
2907
						wait(0.2)
2908
						Weapon.TargetPos.Value = Target.Position + Target.Velocity / 8 + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
2909
						Weapon.Active.Value = true
2910
					end
2911
				end
2912
				IsInCombat = true
2913
			elseif Distance <= 100 then
2914
				local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 120
2915
				Prep(Position, Base)
2916
			end
2917
		end
2918
		if IsInCombat == true then
2919
			wait(0.2)
2920
		else
2921
			wait(0.6)
2922
		end
2923
	end
2924
	local Weapon = nil
2925
	local ToolCheck = script.Parent:GetChildren()
2926
	for Check = 1, #ToolCheck do
2927
		if ToolCheck[Check].ClassName == "Tool" then
2928
			Weapon = ToolCheck[Check]
2929
		end
2930
	end
2931
	if Weapon ~= nil and script.Parent.DropWeapon.Value == true then
2932
		Weapon.Parent = Workspace
2933
	elseif Weapon ~= nil then
2934
		Weapon:Remove()
2935
	end
2936
	if script.Parent:FindFirstChild("IsAZombie") ~= nil then
2937
		script.Parent.Name = "New Zombie"
2938
		script.Parent.Humanoid.MaxHealth = script.Parent.Humanoid.MaxHealth + math.random(math.random(-50, -25), math.random(25, math.random(50, 100)))
2939
		wait()
2940
		script.Parent.Humanoid.Health = script.Parent.Humanoid.MaxHealth
2941
		script.Parent.Humanoid.WalkSpeed = script.Parent.Humanoid.WalkSpeed + math.random(math.random(-200, 0), math.random(100, math.random(200, 300))) / 100
2942
		ZStat = 2
2943
		ZStat2 = 1.57
2944
		Delay(1, function()
2945
			while script.Parent:FindFirstChild("Humanoid") ~= nil and script.Parent.Humanoid.Health > 0 do
2946
				script.Parent.Humanoid.MaxHealth = math.max(0, script.Parent.Humanoid.MaxHealth - 1)
2947
				script.Parent.Humanoid.Health = math.min(script.Parent.Humanoid.Health, script.Parent.Humanoid.MaxHealth)
2948
				wait(1)
2949
			end
2950
		end)
2951
		while script.Parent.Humanoid.Health > 0 and script.Parent:FindFirstChild("IsAZombie") ~= nil do
2952
			local Distance = 100
2953
			local Target = nil
2954
			local Players = Workspace:GetChildren()
2955
			for Check = 1, #Players do
2956
				if Players[Check]:FindFirstChild("Humanoid") ~= nil and Players[Check]:FindFirstChild("Torso") ~= nil and Players[Check]:FindFirstChild("IsAZombie") == nil and Players[Check].Humanoid.Health > 0 and (Players[Check].Torso.Position - script.Parent.Torso.Position).Magnitude <= 100 then
2957
					local ZRay = Ray.new(script.Parent.Torso.CFrame.p, (Players[Check].Torso.CFrame.p - script.Parent.Torso.CFrame.p).Unit * 100)
2958
					local ZHit, ZPos = Workspace:FindPartOnRay(ZRay, script.Parent)
2959
					if Players[Check]:FindFirstChild("ZFound") ~= nil or (ZHit ~= nil and ZHit.Parent ~= nil and ZHit.Parent.Parent ~= nil and (ZHit.Parent == Players[Check] or ZHit.Parent.Parent == Players[Check])) then
2960
						if ZHit ~= nil and ZHit.Parent ~= nil and ZHit.Parent.Parent ~= nil and (ZHit.Parent == Players[Check] or ZHit.Parent.Parent == Players[Check]) then
2961
							if Players[Check]:FindFirstChild("ZFound") ~= nil then
2962
								Players[Check].ZFound:Remove()
2963
							end
2964
							local ZTag = Instance.new("CFrameValue", Players[Check])
2965
							ZTag.Name = "ZFound"
2966
							game:GetService("Debris"):AddItem(ZTag, 5)
2967
						end
2968
						if (Players[Check].Torso.Position - script.Parent.Torso.Position).Magnitude <= Distance then
2969
							Target = Players[Check].Torso
2970
							Distance = (Target.Position - script.Parent.Torso.Position).Magnitude
2971
						end
2972
					end
2973
				end
2974
			end
2975
			if Target == nil then
2976
				if script.Parent.Humanoid.PlatformStand == false and script.Parent.Humanoid.Sit == false then
2977
					if math.random(1, 10) == 1 and script.Parent.Wander.Value == true then
2978
						Prep(script.Parent.Torso.Position + Vector3.new(math.random(-100, 100), 0, math.random(-100, 100)), Base)
2979
					end
2980
				else
2981
					Jump()
2982
				end
2983
			elseif script.Parent.Wander.Value == true then
2984
				script.Parent.Humanoid:MoveTo(Target.Position + Vector3.new(math.random(-2, 2), 0, math.random(-2, 2)), Target)
2985
			end
2986
			wait(0.8)
2987
		end
2988
	end
2989
end)
2990
Delay(0, function() --Random Tool Usage Script
2991
	while true do
2992
		wait(math.random(40, 70 + math.random(30, 120)) / 10)
2993
		local Weapon = nil
2994
		local ToolCheck = script.Parent:GetChildren()
2995
		for Check = 1, #ToolCheck do
2996
			if ToolCheck[Check].ClassName == "Tool" then
2997
				Weapon = ToolCheck[Check]
2998
			end
2999
		end
3000
		if Weapon ~= nil and Weapon:FindFirstChild("Active") ~= nil and Weapon:FindFirstChild("TargetPos") ~= nil and Weapon:FindFirstChild("Type") ~= nil then
3001
			if Weapon.Type.Value == "HealDrink" then
3002
				Weapon.Active.Value = true
3003
			end
3004
		end
3005
	end
3006
end)
3007
Delay(1, function() --Player Customization Script
3008
	if script.Parent["Custom_Name"].Value == "" then
3009
		script.Parent.Name = "Player" ..math.random(1, 999)
3010
	else
3011
		script.Parent.Name = script.Parent["Custom_Name"].Value
3012
	end
3013
	BColors = {3, 5, 12, 18, 108, 128, 138, 224, 224, 226, 226}
3014
	SColors = {145, 146, 147, 148, 149, 150, 168, 176, 178, 179, 200}
3015
	PColors = {190, 191, 193, 1024, 1025, 1026, 1027, 1028, 1029, 1030}
3016
	BColor = BrickColor.new(BColors[math.random(1, #BColors)])
3017
	SColor = BrickColor.new(SColors[math.random(1, #SColors)])
3018
	PColor = BrickColor.new(PColors[math.random(1, #PColors)])
3019
	if script.Parent.IsOnTeam.Value == true then
3020
		SColor = script.Parent.IsOnTeam.Team.Value
3021
		PColor = SColor
3022
		if script.Parent.IsOnTeam.ShowTag.Value == true then
3023
			script.Parent.Name = script.Parent.Name .." [" ..script.Parent.IsOnTeam.Team.Value.Name .."]"
3024
		end
3025
	end
3026
	if script.Parent["Body Colors"].ForceColors.Value ~= true then
3027
		script.Parent["Body Colors"].HeadColor = BColor
3028
		script.Parent["Body Colors"].LeftArmColor = BColor
3029
		script.Parent["Body Colors"].LeftLegColor = PColor
3030
		script.Parent["Body Colors"].RightArmColor = BColor
3031
		script.Parent["Body Colors"].RightLegColor = PColor
3032
		script.Parent["Body Colors"].TorsoColor = SColor
3033
	end
3034
	script.Parent.Head.BrickColor = script.Parent["Body Colors"].HeadColor
3035
	script.Parent["Left Arm"].BrickColor = script.Parent["Body Colors"].LeftArmColor
3036
	script.Parent["Left Leg"].BrickColor = script.Parent["Body Colors"].LeftLegColor
3037
	script.Parent["Right Arm"].BrickColor = script.Parent["Body Colors"].RightArmColor
3038
	script.Parent["Right Leg"].BrickColor = script.Parent["Body Colors"].RightLegColor
3039
	script.Parent.Torso.BrickColor = script.Parent["Body Colors"].TorsoColor
3040
	if script.Parent["Force_Weapon"].Value ~= 0 then
3041
		local x = game:GetService("InsertService"):LoadAsset(script.Parent["Force_Weapon"].Value)
3042
		local c = x:GetChildren()
3043
		for i = 1, #c do
3044
			if c[i].ClassName == "Tool" and c[i]:FindFirstChild("AIProgram") ~= nil and c[i]:FindFirstChild("Active") ~= nil and c[i]:FindFirstChild("TargetPos") ~= nil and c[i]:FindFirstChild("Type") ~= nil and c[i]:FindFirstChild("Handle") ~= nil then
3045
				c[i].Parent = script.Parent
3046
				script.Parent.DropWeapon.Value = false
3047
			end
3048
		end
3049
	end
3050
	if script.Parent["Force_Hat"].Value ~= 0 then
3051
		local x = game:GetService("InsertService"):LoadAsset(script.Parent["Force_Hat"].Value)
3052
		local c = x:GetChildren()
3053
		for i = 1, #c do
3054
			if c[i].ClassName == "Hat" and c[i]:FindFirstChild("Handle") ~= nil then
3055
				c[i].Parent = script.Parent
3056
			end
3057
		end
3058
	end
3059
	if script.Parent["Force_Shirt"].Value ~= 0 then
3060
		local x = game:GetService("InsertService"):LoadAsset(script.Parent["Force_Shirt"].Value)
3061
		local c = x:GetChildren()
3062
		for i = 1, #c do
3063
			if c[i].ClassName == "Shirt" then
3064
				c[i].Parent = script.Parent
3065
			end
3066
		end
3067
	end
3068
	if script.Parent["Force_Pants"].Value ~= 0 then
3069
		local x = game:GetService("InsertService"):LoadAsset(script.Parent["Force_Pants"].Value)
3070
		local c = x:GetChildren()
3071
		for i = 1, #c do
3072
			if c[i].ClassName == "Pants" then
3073
				c[i].Parent = script.Parent
3074
			end
3075
		end
3076
	end
3077
end)
3078
wait()
3079
print("Player Bot Loaded")
3080
end))
3081
Model0.Humanoid.Died:connect(function()
3082
	Model0:remove()
3083
	YOURCLONE=nil
3084
end)
3085
3086
Model0.Torso.Position=Vector3.new(Character.Torso.Position.X,Character.Torso.Position.Y+3,Character.Torso.Position.Z)
3087
Model0.Name=Character.Name.."'s clone"
3088
Model0.Humanoid.WalkToPart=torso
3089
YOURCLONE=Model0
3090
for i,v in pairs(mas:GetChildren()) do
3091
	v.Parent = workspace
3092
	pcall(function() v:MakeJoints() end)
3093
end
3094
mas:Destroy()
3095
for i,v in pairs(cors) do
3096
	spawn(function()
3097
		pcall(v)
3098
	end)
3099
end
3100
end
3101
3102
--Converted with ttyyuu12345's model to script plugin v4
3103
function sandbox(var,func)
3104
	local env = getfenv(func)
3105
	local newenv = setmetatable({},{
3106
		__index = function(self,k)
3107
			if k=="script" then
3108
				return var
3109
			else
3110
				return env[k]
3111
			end
3112
		end,
3113
	})
3114
	setfenv(func,newenv)
3115
	return func
3116
end
3117
cors = {}
3118
mas = Instance.new("Model",game:GetService("Lighting"))
3119
Model0 = Instance.new("Model")
3120
MEF=Model0
3121
Part1 = Instance.new("Part")
3122
SpecialMesh2 = Instance.new("SpecialMesh")
3123
Part3 = Instance.new("Part")
3124
SpecialMesh4 = Instance.new("SpecialMesh")
3125
Part5 = Instance.new("Part")
3126
SpecialMesh6 = Instance.new("SpecialMesh")
3127
Part7 = Instance.new("Part")
3128
SpecialMesh8 = Instance.new("SpecialMesh")
3129
Part9 = Instance.new("Part")
3130
SpecialMesh10 = Instance.new("SpecialMesh")
3131
Part11 = Instance.new("Part")
3132
SpecialMesh12 = Instance.new("SpecialMesh")
3133
Model0.Parent = mas
3134
Part1.Name = "Right Arm"
3135
Part1.Parent = Model0
3136
Part1.Material = Enum.Material.Glass
3137
Part1.BrickColor = BrickColor.new("Pastel blue-green")
3138
Part1.Rotation = Vector3.new(-180, 0, -90)
3139
Part1.Size = Vector3.new(4, 1, 2)
3140
Part1.CFrame = CFrame.new(-12.3300028, 0.500003994, -1.11000025, 0, 1, 0, 1, 0, 0, 0, 0, -1)
3141
Part1.BottomSurface = Enum.SurfaceType.Smooth
3142
Part1.TopSurface = Enum.SurfaceType.Smooth
3143
Part1.Color = Color3.new(0.623529, 0.952941, 0.913726)
3144
Part1.Position = Vector3.new(-12.3300028, 0.500003994, -1.11000025)
3145
Part1.Orientation = Vector3.new(0, 180, 90)
3146
Part1.Color = Color3.new(0.623529, 0.952941, 0.913726)
3147
SpecialMesh2.Parent = Part1
3148
SpecialMesh2.MeshId = "rbxassetid://1563415862"
3149
SpecialMesh2.Offset = Vector3.new(0, 4, 0)
3150
SpecialMesh2.MeshType = Enum.MeshType.FileMesh
3151
Part3.Name = "Right Leg"
3152
Part3.Parent = Model0
3153
Part3.Material = Enum.Material.Glass
3154
Part3.BrickColor = BrickColor.new("Pastel blue-green")
3155
Part3.Rotation = Vector3.new(-180, 0, -90)
3156
Part3.Size = Vector3.new(4, 1, 2)
3157
Part3.CFrame = CFrame.new(-14.3400002, 0.500003994, -0.0500001721, 0, 1, 0, 1, 0, 0, 0, 0, -1)
3158
Part3.BottomSurface = Enum.SurfaceType.Smooth
3159
Part3.TopSurface = Enum.SurfaceType.Smooth
3160
Part3.Color = Color3.new(0.623529, 0.952941, 0.913726)
3161
Part3.Position = Vector3.new(-14.3400002, 0.500003994, -0.0500001721)
3162
Part3.Orientation = Vector3.new(0, 180, 90)
3163
Part3.Color = Color3.new(0.623529, 0.952941, 0.913726)
3164
SpecialMesh4.Parent = Part3
3165
SpecialMesh4.MeshId = "rbxassetid://1563410216"
3166
SpecialMesh4.Offset = Vector3.new(0, 4, 0)
3167
SpecialMesh4.MeshType = Enum.MeshType.FileMesh
3168
Part5.Name = "Left Leg"
3169
Part5.Parent = Model0
3170
Part5.Material = Enum.Material.Glass
3171
Part5.BrickColor = BrickColor.new("Pastel blue-green")
3172
Part5.Rotation = Vector3.new(-180, 0, -90)
3173
Part5.Size = Vector3.new(4, 1, 2)
3174
Part5.CFrame = CFrame.new(-14.3299971, 0.500003994, 1.17999947, 0, 1, 0, 1, 0, 0, 0, 0, -1)
3175
Part5.BottomSurface = Enum.SurfaceType.Smooth
3176
Part5.TopSurface = Enum.SurfaceType.Smooth
3177
Part5.Color = Color3.new(0.623529, 0.952941, 0.913726)
3178
Part5.Position = Vector3.new(-14.3299971, 0.500003994, 1.17999947)
3179
Part5.Orientation = Vector3.new(0, 180, 90)
3180
Part5.Color = Color3.new(0.623529, 0.952941, 0.913726)
3181
SpecialMesh6.Parent = Part5
3182
SpecialMesh6.MeshId = "rbxassetid://1563408982"
3183
SpecialMesh6.Offset = Vector3.new(0, 4, 0)
3184
SpecialMesh6.MeshType = Enum.MeshType.FileMesh
3185
Part7.Name = "Left Arm"
3186
Part7.Parent = Model0
3187
Part7.Material = Enum.Material.Glass
3188
Part7.BrickColor = BrickColor.new("Pastel blue-green")
3189
Part7.Rotation = Vector3.new(0, 0, -90)
3190
Part7.Size = Vector3.new(4, 1, 2)
3191
Part7.CFrame = CFrame.new(-12.2099981, 0.490003794, 2.1400013, 0, 1, 0, -1, 0, 0, 0, 0, 1)
3192
Part7.BottomSurface = Enum.SurfaceType.Smooth
3193
Part7.TopSurface = Enum.SurfaceType.Smooth
3194
Part7.Color = Color3.new(0.623529, 0.952941, 0.913726)
3195
Part7.Position = Vector3.new(-12.2099981, 0.490003794, 2.1400013)
3196
Part7.Orientation = Vector3.new(0, 0, -90)
3197
Part7.Color = Color3.new(0.623529, 0.952941, 0.913726)
3198
SpecialMesh8.Parent = Part7
3199
SpecialMesh8.MeshId = "rbxassetid://1563407350"
3200
SpecialMesh8.Offset = Vector3.new(0, 4, 0)
3201
SpecialMesh8.MeshType = Enum.MeshType.FileMesh
3202
Part9.Name = "Torso"
3203
Part9.Parent = Model0
3204
Part9.Material = Enum.Material.Glass
3205
Part9.BrickColor = BrickColor.new("Pastel blue-green")
3206
Part9.Rotation = Vector3.new(-180, 0, -90)
3207
Part9.Size = Vector3.new(4, 1, 2)
3208
Part9.CFrame = CFrame.new(-12.6299973, 0.500003994, 0.519999921, 0, 1, 0, 1, 0, 0, 0, 0, -1)
3209
Part9.BottomSurface = Enum.SurfaceType.Smooth
3210
Part9.TopSurface = Enum.SurfaceType.Smooth
3211
Part9.Color = Color3.new(0.623529, 0.952941, 0.913726)
3212
Part9.Position = Vector3.new(-12.6299973, 0.500003994, 0.519999921)
3213
Part9.Orientation = Vector3.new(0, 180, 90)
3214
Part9.Color = Color3.new(0.623529, 0.952941, 0.913726)
3215
SpecialMesh10.Parent = Part9
3216
SpecialMesh10.MeshId = "rbxassetid://1563386325"
3217
SpecialMesh10.MeshType = Enum.MeshType.FileMesh
3218
Part11.Name = "Head"
3219
Part11.Parent = Model0
3220
Part11.Material = Enum.Material.Glass
3221
Part11.BrickColor = BrickColor.new("Pastel blue-green")
3222
Part11.Rotation = Vector3.new(-180, 0, -90)
3223
Part11.Size = Vector3.new(4, 1, 2)
3224
Part11.CFrame = CFrame.new(-10.1799965, 0.500003994, 0.519999921, 0, 1, 0, 1, 0, 0, 0, 0, -1)
3225
Part11.BottomSurface = Enum.SurfaceType.Smooth
3226
Part11.TopSurface = Enum.SurfaceType.Smooth
3227
Part11.Color = Color3.new(0.623529, 0.952941, 0.913726)
3228
Part11.Position = Vector3.new(-10.1799965, 0.500003994, 0.519999921)
3229
Part11.Orientation = Vector3.new(0, 180, 90)
3230
Part11.Color = Color3.new(0.623529, 0.952941, 0.913726)
3231
SpecialMesh12.Parent = Part11
3232
SpecialMesh12.MeshId = "rbxassetid://1563390192"
3233
SpecialMesh12.MeshType = Enum.MeshType.FileMesh
3234
for i,v in pairs(mas:GetChildren()) do
3235
	v.Parent = AdvancingFortress
3236
	pcall(function() v:MakeJoints() end)
3237
end
3238
mas:Destroy()
3239
for i,v in pairs(cors) do
3240
	spawn(function()
3241
		pcall(v)
3242
	end)
3243
end
3244
--end of costume
3245
3246
3247
  AdvancingFortress.Parent = Character
3248
  torso = AdvancingFortress.Torso
3249
  hum = AdvancingFortress.Humanoid
3250
  AdvancingFortress.Name = "Advancing Fortress"
3251
  pl = AdvancingFortress
3252
  for i, v in pairs(AdvancingFortress:GetChildren()) do
3253
    if v:IsA("BasePart") then
3254
      v.Transparency = 1
3255
    end
3256
  end
3257
  local Humanoid = AdvancingFortress.Humanoid
3258
  local Mouse = Player:GetMouse()
3259
  local LeftArm = AdvancingFortress["Left Arm"]
3260
  local RightArm = AdvancingFortress["Right Arm"]
3261
  local LeftLeg = AdvancingFortress["Left Leg"]
3262
  local RightLeg = AdvancingFortress["Right Leg"]
3263
  local Head = AdvancingFortress.Head
3264
  local Torso = AdvancingFortress.Torso
3265
  local Camera = game.Workspace.CurrentCamera
3266
  local RootPart = AdvancingFortress.HumanoidRootPart
3267
  local RootJoint = RootPart.RootJoint
3268
  local attack = false
3269
  local Anim = "Idle"
3270
  local attacktype = 1
3271
  local Torsovelocity = (RootPart.Velocity * Vector3.new(1, 0, 1)).magnitude
3272
  local velocity = RootPart.Velocity.y
3273
  local sine = 0
3274
  local change = 1
3275
  local Create = LoadLibrary("RbxUtility").Create
3276
  local TimeStop = false
3277
  local m = Create("Model")({
3278
    Parent = AdvancingFortress,
3279
    Name = "WeaponModel"
3280
  })
3281
--for _,v in pairs(KQ) do
3282
--v.Transparency=1	
3283
--end
3284
KQ={
3285
	
3286
}
3287
3288
  AdvancingFortress.Head.Name = "FHead"
3289
  AdvancingFortress.Torso.Name = "FTorso"
3290
3291
3292
shirt = Instance.new("Shirt", Character)
3293
shirt.Name = "Shirt"
3294
pants = Instance.new("Pants", Character)
3295
pants.Name = "Pants"
3296
Character.Shirt.ShirtTemplate = "rbxassetid://609199174"
3297
Character.Pants.PantsTemplate = "rbxassetid://1079566963"
3298
 
3299
for i, v in pairs(Character:GetChildren()) do
3300
    if v.ClassName == "Accessory" then
3301
        v:Remove()
3302
    end
3303
end
3304
 
3305
Hat3 = Instance.new("Model")
3306
Hat3.Parent = Character
3307
Hat3.Name = "Hat3"
3308
rh = Instance.new("Part")
3309
rh.Parent = Hat3
3310
rh.BrickColor = BrickColor.new("Cool yellow")
3311
rh.Locked = true
3312
rh.CanCollide = false
3313
mesh = Instance.new("SpecialMesh")
3314
rh.formFactor =  "Symmetric"
3315
mesh.MeshType = "FileMesh"
3316
mesh.MeshId = "rbxassetid://495152230"
3317
mesh.Parent = rh
3318
local weld = Instance.new("Weld")
3319
weld.Parent = rh
3320
weld.Part0 = rh
3321
weld.Part1 =Character.Head
3322
weld.C0 = CFrame.new(0, 0.4, 0)*CFrame.Angles(0, 0, 0)
3323
mesh.Scale = Vector3.new(1,1,1)
3324
Hat3.Part.Transparency = 0
3325
3326
for _,v in pairs(AdvancingFortress:GetChildren()) do
3327
	if v:IsA('Part') then
3328
		v.BrickColor=BrickColor.new('Pastel blue-green')
3329
	end
3330
end
3331
  for _,v in pairs(MEF:GetChildren()) do
3332
	table.insert(KQ,v)
3333
	v.CanCollide=false
3334
	if v.Name=='Head' or v.Name=='Torso' then
3335
	g=AdvancingFortress['F'..v.Name]
3336
	else
3337
	g=AdvancingFortress[v.Name]
3338
	end
3339
	v.Parent=AdvancingFortress
3340
	v.Transparency=1
3341
	weld=Instance.new('Weld',v)
3342
	if v.Name=='Head' then
3343
	weld.C0=CFrame.new(0,-1,0)*CFrame.Angles(0,-1.5,0)
3344
	elseif v.Name=='Torso' then
3345
		weld.C0=CFrame.new(0,0,0)*CFrame.Angles(0,-1.5,0)
3346
	elseif v.Name=='Left Arm' then
3347
		weld.C0=CFrame.new(0,0,0)*CFrame.Angles(0,1.5,0)
3348
	elseif v.Name=='Left Leg' then
3349
		weld.C0=CFrame.new(0,0,0)*CFrame.Angles(0,-1.5,0)
3350
	elseif v.Name=='Right Arm' then
3351
		weld.C0=CFrame.new(0,0,0)*CFrame.Angles(0,-1.5,0)
3352
	elseif v.Name=='Right Leg' then
3353
		weld.C0=CFrame.new(0,0,0)*CFrame.Angles(0,-1.5,0)
3354
end	
3355
	weld.Part0=v
3356
	weld.Part1=g
3357
	end-- apply costume
3358
AdvancingFortress.FTorso.BrickColor=BrickColor.new('Pastel blue-green')
3359
3360
  AdvancingFortress.HumanoidRootPart.Name = "FHumanoidRootPart"
3361
  Humanoid.Animator.Parent = nil
3362
  AdvancingFortress.Animate.Parent = nil
3363
3364
base = Instance.new("ScreenGui",plr.PlayerGui)
3365
bbg = Instance.new("BillboardGui",plr.Character.Head)
3366
bbg.Size = UDim2.new(0,200,0,50)
3367
bbg.StudsOffset = Vector3.new(0,3,0)
3368
3369
bbgTl = Instance.new("TextLabel",bbg)
3370
bbgTl.BackgroundTransparency = 1
3371
bbgTl.Size = UDim2.new(10,0,1,0)
3372
bbgTl.Position = UDim2.new(-4.5,0,0,0)
3373
bbgTl.Font = "Code"
3374
bbgTl.Text = " "
3375
bbgTl.TextSize = 25
3376
bbgTl.TextStrokeColor3 = Color3.new(1,1,1)
3377
bbgTl.TextColor3 = Color3.new(0,0,0)
3378
bbgTl.TextStrokeTransparency = 0
3379
bbgTl.TextWrapped = true
3380
3381
function Chat(msg)
3382
	if msg=='NANI' then
3383
	      CFuncs.Sound.Create(948494432, Torso, 1, 1)
3384
	end
3385
	ff=game.Chat:FilterStringAsync(msg,Player,Player)
3386
	bbgTl.Text = ff
3387
	wait(1)
3388
	if bbgTl.Text == ff then
3389
		bbgTl.Text = " "
3390
	end
3391
end
3392
lknives=false
3393
3394
 
3395
-- Fired when client sends a request to write on the sign
3396
-- Called when button is clicked
3397
3398
		
3399
plr.Chatted:connect(function(msg)--			local messageObject = getTextObject(msg, Player.UserId)
3400
	Chat(msg)
3401
end)
3402
3403
3404
  local function newMotor(part0, part1, c0, c1)
3405
    local w = Create("Weld")({
3406
      Parent = part0,
3407
      Part0 = part0,
3408
      Part1 = part1,
3409
      C0 = c0,
3410
      C1 = c1
3411
    })
3412
    return w
3413
  end
3414
  function clerp(a, b, t)
3415
    return a:lerp(b, t)
3416
  end
3417
  RootCF = CFrame.fromEulerAnglesXYZ(-1.57, 0, 3.14)
3418
  NeckCF = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
3419
  local RW = newMotor(Torso, RightArm, CFrame.new(1.5, 0, 0), CFrame.new(0, 0, 0))
3420
  local LW = newMotor(Torso, LeftArm, CFrame.new(-1.5, 0, 0), CFrame.new(0, 0, 0))
3421
  local RH = newMotor(Torso, RightLeg, CFrame.new(0.5, -2, 0), CFrame.new(0, 0, 0))
3422
  local LH = newMotor(Torso, LeftLeg, CFrame.new(-0.5, -2, 0), CFrame.new(0, 0, 0))
3423
  RootJoint.C1 = CFrame.new(0, 0, 0)
3424
  RootJoint.C0 = CFrame.new(0, 0, 0)
3425
  Torso.Neck.C1 = CFrame.new(0, 0, 0)
3426
  Torso.Neck.C0 = CFrame.new(0, 1.5, 0)
3427
  local rarmc1 = RW.C1
3428
  local larmc1 = LW.C1
3429
  local rlegc1 = RH.C1
3430
  local llegc1 = LH.C1
3431
  local resetc1 = false
3432
  function PlayAnimationFromTable(table, speed, bool)
3433
    RootJoint.C0 = clerp(RootJoint.C0, table[1], speed)
3434
    Torso.Neck.C0 = clerp(Torso.Neck.C0, table[2], speed)
3435
    RW.C0 = clerp(RW.C0, table[3], speed)
3436
    LW.C0 = clerp(LW.C0, table[4], speed)
3437
    RH.C0 = clerp(RH.C0, table[5], speed)
3438
    LH.C0 = clerp(LH.C0, table[6], speed)
3439
    if bool == true and resetc1 == false then
3440
      resetc1 = true
3441
      RootJoint.C1 = RootJoint.C1
3442
      Torso.Neck.C1 = Torso.Neck.C1
3443
      RW.C1 = rarmc1
3444
      LW.C1 = larmc1
3445
      RH.C1 = rlegc1
3446
      LH.C1 = llegc1
3447
    end
3448
  end
3449
  ArtificialHB = Create("BindableEvent", script)({Parent = script, Name = "Heartbeat"})
3450
  script:WaitForChild("Heartbeat")
3451
  frame = 0.03333333333333333
3452
  tf = 0
3453
  allowframeloss = false
3454
  tossremainder = false
3455
  lastframe = tick()
3456
  script.Heartbeat:Fire()
3457
  game:GetService("RunService").Heartbeat:connect(function(s, p)
3458
    tf = tf + s
3459
    if tf >= frame then
3460
      if allowframeloss then
3461
        script.Heartbeat:Fire()
3462
        lastframe = tick()
3463
      else
3464
        for i = 1, math.floor(tf / frame) do
3465
          script.Heartbeat:Fire()
3466
        end
3467
        lastframe = tick()
3468
      end
3469
      if tossremainder then
3470
        tf = 0
3471
      else
3472
        tf = tf - frame * math.floor(tf / frame)
3473
      end
3474
    end
3475
  end)
3476
  function swait(num)
3477
    if num == 0 or num == nil then
3478
      ArtificialHB.Event:wait()
3479
    else
3480
      for i = 0, num do
3481
        ArtificialHB.Event:wait()
3482
      end
3483
    end
3484
  end
3485
  function RemoveOutlines(part)
3486
    part.TopSurface, part.BottomSurface, part.LeftSurface, part.RightSurface, part.FrontSurface, part.BackSurface = 10, 10, 10, 10, 10, 10
3487
  end
3488
  CFuncs = {
3489
    Part = {
3490
      Create = function(Parent, Material, Reflectance, Transparency, BColor, Name, Size)
3491
        local Part = Create("Part")({
3492
          Parent = Parent,
3493
          Reflectance = Reflectance,
3494
          Transparency = Transparency,
3495
          CanCollide = false,
3496
          Locked = true,
3497
          BrickColor = BrickColor.new(tostring(BColor)),
3498
          Name = Name,
3499
          Size = Size,
3500
          Material = Material
3501
        })
3502
        RemoveOutlines(Part)
3503
        return Part
3504
      end
3505
    },
3506
    Mesh = {
3507
      Create = function(Mesh, Part, MeshType, MeshId, OffSet, Scale)
3508
        local Msh = Create(Mesh)({
3509
          Parent = Part,
3510
          Offset = OffSet,
3511
          Scale = Scale
3512
        })
3513
        if Mesh == "SpecialMesh" then
3514
          Msh.MeshType = MeshType
3515
          Msh.MeshId = MeshId
3516
        end
3517
        return Msh
3518
      end
3519
    },
3520
    Weld = {
3521
      Create = function(Parent, Part0, Part1, C0, C1)
3522
        local Weld = Create("Weld")({
3523
          Parent = Parent,
3524
          Part0 = Part0,
3525
          Part1 = Part1,
3526
          C0 = C0,
3527
          C1 = C1
3528
        })
3529
        return Weld
3530
      end
3531
    },
3532
    Sound = {
3533
      Create = function(id, par, vol, pit)
3534
        local Sound = Create("Sound")({
3535
          Volume = vol,
3536
          Pitch = pit or 1,
3537
          SoundId = "rbxassetid://" .. id,
3538
          Parent = par or workspace
3539
        })
3540
        Sound:play()
3541
        game:GetService("Debris"):AddItem(Sound, 130)
3542
        return Sound
3543
      end
3544
    },
3545
    Decal = {
3546
      Create = function(Color, Texture, Transparency, Name, Parent)
3547
        local Decal = Create("Decal")({
3548
          Color3 = Color,
3549
          Texture = "rbxassetid://" .. Texture,
3550
          Transparency = Transparency,
3551
          Name = Name,
3552
          Parent = Parent
3553
        })
3554
        return Decal
3555
      end
3556
    },
3557
    BillboardGui = {
3558
      Create = function(Parent, Image, Position, Size)
3559
        local BillPar = CFuncs.Part.Create(Parent, "SmoothPlastic", 0, 1, BrickColor.new("Black"), "BillboardGuiPart", Vector3.new(1, 1, 1))
3560
        BillPar.CFrame = CFrame.new(Position)
3561
        local Bill = Create("BillboardGui")({
3562
          Parent = BillPar,
3563
          Adornee = BillPar,
3564
          Size = UDim2.new(1, 0, 1, 0),
3565
          SizeOffset = Vector2.new(Size, Size)
3566
        })
3567
        local d = Create("ImageLabel", Bill)({
3568
          Parent = Bill,
3569
          BackgroundTransparency = 1,
3570
          Size = UDim2.new(1, 0, 1, 0),
3571
          Image = "rbxassetid://" .. Image
3572
        })
3573
        return BillPar
3574
      end
3575
    },
3576
    ParticleEmitter = {
3577
      Create = function(Parent, Color1, Color2, LightEmission, Size, Texture, Transparency, ZOffset, Accel, Drag, LockedToPart, VelocityInheritance, EmissionDirection, Enabled, LifeTime, Rate, Rotation, RotSpeed, Speed, VelocitySpread)
3578
        local Particle = Create("ParticleEmitter")({
3579
          Parent = Parent,
3580
          Color = ColorSequence.new(Color1, Color2),
3581
          LightEmission = LightEmission,
3582
          Size = Size,
3583
          Texture = Texture,
3584
          Transparency = Transparency,
3585
          ZOffset = ZOffset,
3586
          Acceleration = Accel,
3587
          Drag = Drag,
3588
          LockedToPart = LockedToPart,
3589
          VelocityInheritance = VelocityInheritance,
3590
          EmissionDirection = EmissionDirection,
3591
          Enabled = Enabled,
3592
          Lifetime = LifeTime,
3593
          Rate = Rate,
3594
          Rotation = Rotation,
3595
          RotSpeed = RotSpeed,
3596
          Speed = Speed,
3597
          VelocitySpread = VelocitySpread
3598
        })
3599
        return Particle
3600
      end
3601
    },
3602
    CreateTemplate = {}
3603
  }
3604
  function rayCast(Position, Direction, Range, Ignore)
3605
    return game:service("Workspace"):FindPartOnRay(Ray.new(Position, Direction.unit * (Range or 999.999)), Ignore)
3606
  end
3607
  function FindNearestTorso(pos)
3608
    local list = game.Workspace:children()
3609
    local torso
3610
    local dist = 1000
3611
    local temp, human, temp2
3612
    for x = 1, #list do
3613
      temp2 = list[x]
3614
      if temp2.className == "Model" and temp2.Name ~= Character.Name then
3615
        temp = temp2:findFirstChild("Torso")
3616
        human = temp2:findFirstChild("Humanoid")
3617
        if temp ~= nil and human ~= nil and human.Health > 0 and dist > (temp.Position - pos).magnitude then
3618
          local dohit = true
3619
          if dohit == true then
3620
            torso = temp
3621
            dist = (temp.Position - pos).magnitude
3622
          end
3623
        end
3624
      end
3625
    end
3626
    return torso, dist
3627
  end
3628
  function Damage(Part, hit, minim, maxim, knockback, Type, Property, Delay, HitSound, HitPitch)
3629
    if hit.Parent == nil then
3630
      return
3631
    end
3632
    local h = hit.Parent:FindFirstChild("Humanoid")
3633
    for _, v in pairs(hit.Parent:children()) do
3634
   		  c=hit.Parent:findFirstChild('HumanoidRootPart') 
3635
		if v:IsA("Humanoid") then
3636
        h = v
3637
		if c~=nil then
3638
		end
3639
      end
3640
    end
3641
    if h ~= nil and hit.Parent.Name ~= Character.Name and hit.Parent:FindFirstChild("Torso") ~= nil then
3642
      if hit.Parent:findFirstChild("DebounceHit") ~= nil and hit.Parent.DebounceHit.Value == true then
3643
        return
3644
      end
3645
      local c = Create("ObjectValue")({
3646
        Name = "creator",
3647
        Value = game:service("Players").LocalPlayer,
3648
        Parent = h
3649
      })
3650
      game:GetService("Debris"):AddItem(c, 0.5)
3651
      CFuncs.Sound.Create(HitSound, hit, 1, HitPitch)
3652
      local Damage = math.random(minim, maxim)
3653
      local blocked = false
3654
      local block = hit.Parent:findFirstChild("Block")
3655
      if block ~= nil and block.className == "IntValue" and block.Value > 0 then
3656
        blocked = true
3657
        block.Value = block.Value - 1
3658
        print(block.Value)
3659
      end
3660
      if TimeStop == false then
3661
        h.Health = h.Health - Damage
3662
        ShowDamage(Part.CFrame * CFrame.new(0, 0, Part.Size.Z / 2).p + Vector3.new(0, 1.5, 0), -Damage, 1.5, BrickColor.new("Pastel blue-green").Color)
3663
      elseif TimeStop == true then
3664
        repeat
3665
          wait()
3666
        until TimeStop == false
3667
        h.Health = h.Health - Damage / 2
3668
        ShowDamage(Part.CFrame * CFrame.new(0, 0, Part.Size.Z / 2).p + Vector3.new(0, 1.5, 0), -Damage, 1.5, BrickColor.new("Pastel blue-green").Color)
3669
      end
3670
      if Type == "Knockdown" then
3671
        local hum = hit.Parent.Humanoid
3672
        hum.PlatformStand = true
3673
        coroutine.resume(coroutine.create(function(HHumanoid)
3674
          swait(1)
3675
          HHumanoid.PlatformStand = false
3676
        end), hum)
3677
        local angle = hit.Position - (Property.Position + Vector3.new(0, 0, 0)).unit
3678
        local bodvol = Create("BodyVelocity")({
3679
          velocity = angle * knockback,
3680
          P = 5000,
3681
          maxForce = Vector3.new(8000, 8000, 8000),
3682
          Parent = hit
3683
        })
3684
        local rl = Create("BodyAngularVelocity")({
3685
          P = 3000,
3686
          maxTorque = Vector3.new(500000, 500000, 500000) * 50000000000000,
3687
          angularvelocity = Vector3.new(math.random(-10, 10), math.random(-10, 10), math.random(-10, 10)),
3688
          Parent = hit
3689
        })
3690
        game:GetService("Debris"):AddItem(bodvol, 0.5)
3691
        game:GetService("Debris"):AddItem(rl, 0.5)
3692
      elseif Type == "Normal" then
3693
        local vp = Create("BodyVelocity")({
3694
          P = 500,
3695
          maxForce = Vector3.new(math.huge, 0, math.huge),
3696
          velocity = Property.CFrame.lookVector * knockback + Property.Velocity / 1.05
3697
        })
3698
        if knockback > 0 then
3699
          vp.Parent = hit.Parent.Torso
3700
        end
3701
        game:GetService("Debris"):AddItem(vp, 0.5)
3702
      elseif Type == "Up" then
3703
        local bodyVelocity = Create("BodyVelocity")({
3704
          velocity = Vector3.new(0, 20, 0),
3705
          P = 5000,
3706
          maxForce = Vector3.new(8000, 8000, 8000),
3707
          Parent = hit
3708
        })
3709
        game:GetService("Debris"):AddItem(bodyVelocity, 0.5)
3710
      elseif Type == "DarkUp" then
3711
        coroutine.resume(coroutine.create(function()
3712
          for i = 0, 1, 0.1 do
3713
            swait()
3714
            Effects.Block.Create(BrickColor.new("Black"), hit.Parent.Torso.CFrame, 5, 5, 5, 1, 1, 1, 0.08, 1)
3715
          end
3716
        end))
3717
        local bodyVelocity = Create("BodyVelocity")({
3718
          velocity = Vector3.new(0, 20, 0),
3719
          P = 5000,
3720
          maxForce = Vector3.new(8000, 8000, 8000),
3721
          Parent = hit
3722
        })
3723
        game:GetService("Debris"):AddItem(bodyVelocity, 1)
3724
      elseif Type == "Snare" then
3725
        local bp = Create("BodyPosition")({
3726
          P = 2000,
3727
          D = 100,
3728
          maxForce = Vector3.new(math.huge, math.huge, math.huge),
3729
          position = hit.Parent.Torso.Position,
3730
          Parent = hit.Parent.Torso
3731
        })
3732
        game:GetService("Debris"):AddItem(bp, 1)
3733
      elseif Type == "Freeze" then
3734
        local BodPos = Create("BodyPosition")({
3735
          P = 50000,
3736
          D = 1000,
3737
          maxForce = Vector3.new(math.huge, math.huge, math.huge),
3738
          position = hit.Parent.Torso.Position,
3739
          Parent = hit.Parent.Torso
3740
        })
3741
        local BodGy = Create("BodyGyro")({
3742
          maxTorque = Vector3.new(400000, 400000, 400000) * math.huge,
3743
          P = 20000,
3744
          Parent = hit.Parent.Torso,
3745
          cframe = hit.Parent.Torso.CFrame
3746
        })
3747
        hit.Parent.Torso.Anchored = true
3748
        coroutine.resume(coroutine.create(function(Part)
3749
          swait(1.5)
3750
          Part.Anchored = false
3751
        end), hit.Parent.Torso)
3752
        game:GetService("Debris"):AddItem(BodPos, 3)
3753
        game:GetService("Debris"):AddItem(BodGy, 3)
3754
      end
3755
      local debounce = Create("BoolValue")({
3756
        Name = "DebounceHit",
3757
        Parent = hit.Parent,
3758
        Value = true
3759
      })
3760
      game:GetService("Debris"):AddItem(debounce, Delay)
3761
      c = Create("ObjectValue")({
3762
        Name = "creator",
3763
        Value = Player,
3764
        Parent = h
3765
      })
3766
      game:GetService("Debris"):AddItem(c, 0.5)
3767
    end
3768
  end
3769
  function ShowDamage(Pos, Text, Time, Color)
3770
    local Rate = 0.03333333333333333
3771
    local Pos = Pos or Vector3.new(0, 0, 0)
3772
    local Text = Text or ""
3773
    local Time = Time or 2
3774
    local Color = Color or Color3.new(1, 0, 1)
3775
    local EffectPart = CFuncs.Part.Create(workspace, "SmoothPlastic", 0, 1, BrickColor.new(Color), "Effect", Vector3.new(0, 0, 0))
3776
    EffectPart.Anchored = true
3777
    local BillboardGui = Create("BillboardGui")({
3778
      Size = UDim2.new(3, 0, 3, 0),
3779
      Adornee = EffectPart,
3780
      Parent = EffectPart
3781
    })
3782
    local TextLabel = Create("TextLabel")({
3783
      BackgroundTransparency = 1,
3784
      Size = UDim2.new(1, 0, 1, 0),
3785
      Text = Text,
3786
      Font = "SciFi",
3787
      TextColor3 = Color,
3788
      TextScaled = true,
3789
      Parent = BillboardGui
3790
    })
3791
    game.Debris:AddItem(EffectPart, Time)
3792
    EffectPart.Parent = game:GetService("Workspace")
3793
    delay(0, function()
3794
      local Frames = Time / Rate
3795
      for Frame = 1, Frames do
3796
        wait(Rate)
3797
        local Percent = Frame / Frames
3798
        EffectPart.CFrame = CFrame.new(Pos) + Vector3.new(0, Percent, 0)
3799
        TextLabel.TextTransparency = Percent
3800
      end
3801
      if EffectPart and EffectPart.Parent then
3802
        EffectPart:Destroy()
3803
      end
3804
    end)
3805
  end
3806
  local STDamage = false
3807
  function MagnitudeDamage(Part, Magnitude, MinimumDamage, MaximumDamage, KnockBack, Type, HitSound, HitPitch)
3808
    for _, c in pairs(workspace:children()) do
3809
      local hum = c:findFirstChild("Humanoid")
3810
      if hum ~= nil then
3811
        local head = c:findFirstChild("Torso")
3812
        if head ~= nil then
3813
          local targ = head.Position - Part.Position
3814
          local mag = targ.magnitude
3815
          if Magnitude >= mag and c.Name ~= Player.Name then
3816
            Damage(head, head, MinimumDamage, MaximumDamage, KnockBack, Type, RootPart, 0.1, HitSound, HitPitch)
3817
            if STDamage == true then
3818
              for i = 1, 3 do
3819
                Effects.Block.Create(BrickColor.new("Pastel blue-green"), head.CFrame, 1, 1, 1, 4, 4, 4, 0.07, 1)
3820
              end
3821
              for i = 1, 10 do
3822
                CamShake(1, 70000)
3823
                Effects.Break.Create(BrickColor.new("Pastel blue-green"), head.CFrame, 1, 1, 1)
3824
              end
3825
            elseif STDamage == false then
3826
              CamShake(1, 90000)
3827
              Effects.Block.Create(BrickColor.new("Pastel blue-green"), head.CFrame, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.07, 1)
3828
              for i = 1, 2 do
3829
                Effects.Break.Create(BrickColor.new("Pastel blue-green"), head.CFrame, 0.4, 0.4, 0.4)
3830
              end
3831
            end
3832
          end
3833
        end
3834
      end
3835
    end
3836
  end
3837
  --[[ 
3838
HHandle = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "HHandle", Vector3.new(1.09999979, 0.299999923, 1.0999999))
3839
  HHandleWeld = CFuncs.Weld.Create(m, Head, HHandle, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0.0646438599, -0.0500068665, -0.0646400452, -0.707107365, -3.21031663E-8, 0.707106411, -8.19564079E-8, 1.00000119, -1.41561088E-7, -0.707106352, 1.38630043E-7, -0.707107484))
3840
  Eye1 = CFuncs.Part.Create(m, Enum.Material.Neon, 0, 1, "White", "Eye1", Vector3.new(0.400000006, 0.200000003, 0.200000003))
3841
  PartWeld = CFuncs.Weld.Create(m, HHandle, Eye1, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0.0381011963, -0.0574798584, 0.471725464, -2.89082527E-6, 0.173647985, -0.984807968, -6.2584877E-7, 0.984808922, 0.173648104, 1.00000012, 1.02902288E-6, -2.77161598E-6))
3842
  CFuncs.Mesh.Create("SpecialMesh", Eye1, Enum.MeshType.Sphere, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
3843
  Eye2 = CFuncs.Part.Create(m, Enum.Material.Neon, 0, 1, "White", "Eye2", Vector3.new(0.400000006, 0.200000003, 0.200000003))
3844
  PartWeld = CFuncs.Weld.Create(m, HHandle, Eye2, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0.0115432739, -0.0487277508, 0.482452393, -0.981060266, -0.173648134, -0.0858327746, -0.172987267, 0.984808922, -0.0151339322, 0.0871568322, 3.96735317E-7, -0.996194839))
3845
  CFuncs.Mesh.Create("SpecialMesh", Eye2, Enum.MeshType.Sphere, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
3846
  THandle = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Medium stone grey", "THandle", Vector3.new(1, 0.799999893, 1))
3847
  THandleWeld = CFuncs.Weld.Create(m, Torso, THandle, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0, 0, 0, 1, -8.19564079E-8, 5.96046519E-8, -8.19564079E-8, 1.00000119, -1.41561088E-7, 5.96046519E-8, -1.41561088E-7, 1.00000024))
3848
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(1.80000019, 0.300000012, 1.80000007))
3849
  PartWeld = CFuncs.Weld.Create(m, THandle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-6.10351563E-5, -1.04342794, -0.404396057, 1, -8.19564079E-8, 5.96046519E-8, -1.01078633E-7, 0.939694166, -0.342019171, 1.52638329E-8, 0.34201926, 0.939693213))
3850
  CFuncs.Mesh.Create("CylinderMesh", Part, "", "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
3851
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.200000003, 1.10000002, 0.300000012))
3852
  PartWeld = CFuncs.Weld.Create(m, THandle, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-5.34057617E-5, -0.943422318, -1.35441589, 1, -8.19564079E-8, 5.96046519E-8, -1.01078633E-7, 0.939694166, -0.342019171, 1.52638329E-8, 0.34201926, 0.939693213))
3853
  CFuncs.Mesh.Create("CylinderMesh", Part, "", "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
3854
--]]
3855
 AHandleR = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "AHandleR", Vector3.new(0.799999952, 0.800000012, 1.22000003))
3856
  AHandleRWeld = CFuncs.Weld.Create(m, RightArm, AHandleR, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.209915161, 0.00999641418, -3.81469727E-6, 1, -8.19564079E-8, 5.96046519E-8, -8.19564079E-8, 1.00000119, -1.41561088E-7, 5.96046519E-8, -1.41561088E-7, 1.00000024))
3857
 --[[ 
3858
3859
 Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.200000003, 0.899999976, 1.01999998))
3860
  PartWeld = CFuncs.Weld.Create(m, AHandleR, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0.0999984741, 0.550004005, 0, 1, -8.19564079E-8, 5.96046519E-8, -8.19564079E-8, 1.00000119, -1.41561088E-7, 5.96046519E-8, -1.41561088E-7, 1.00000024))
3861
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.300000012, 0.200000003, 0.200000003))
3862
  PartWeld = CFuncs.Weld.Create(m, AHandleR, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.150001526, 0.200003624, -0.359994888, 1, -8.19564079E-8, 5.96046519E-8, -8.19564079E-8, 1.00000119, -1.41561088E-7, 5.96046519E-8, -1.41561088E-7, 1.00000024))
3863
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.300000012, 0.200000003, 0.200000003))
3864
  PartWeld = CFuncs.Weld.Create(m, AHandleR, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.149993896, 0.20000267, 0.359992981, 1, -8.19564079E-8, 5.96046519E-8, -8.19564079E-8, 1.00000119, -1.41561088E-7, 5.96046519E-8, -1.41561088E-7, 1.00000024))
3865
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(1.20000005, 0.800000012, 1.20000005))
3866
  PartWeld = CFuncs.Weld.Create(m, AHandleR, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.209899902, -0.809997559, 5.7220459E-6, -1, 8.19564079E-8, -5.96046519E-8, -8.19564079E-8, 1.00000119, -1.41561088E-7, -5.96046519E-8, 1.41561088E-7, -1.00000024))
3867
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.200000003, 0.699999988, 1.01999998))
3868
  PartWeld = CFuncs.Weld.Create(m, AHandleR, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0.300003052, 0.650004387, 1.71661377E-5, 1, -8.19564079E-8, 5.96046519E-8, -8.19564079E-8, 1.00000119, -1.41561088E-7, 5.96046519E-8, -1.41561088E-7, 1.00000024))
3869
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.300000012, 0.699999988, 1.01999998))
3870
  PartWeld = CFuncs.Weld.Create(m, AHandleR, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.149993896, 0.650003433, 0, 1, -8.19564079E-8, 5.96046519E-8, -8.19564079E-8, 1.00000119, -1.41561088E-7, 5.96046519E-8, -1.41561088E-7, 1.00000024))
3871
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.200000003, 0.699999928, 0.520000041))
3872
  PartWeld = CFuncs.Weld.Create(m, AHandleR, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.199996948, -0.049996376, -3.81469727E-6, 1, -8.19564079E-8, 5.96046519E-8, -8.19564079E-8, 1.00000119, -1.41561088E-7, 5.96046519E-8, -1.41561088E-7, 1.00000024))
3873
--]] 
3874
 HitboxR = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "HitboxR", Vector3.new(0.799999952, 0.800000012, 1.22000003))
3875
3876
  HitboxRWeld = CFuncs.Weld.Create(m, AHandleR, HitboxR, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0, 0.700003624, 0, 1, -8.19564079E-8, 5.96046519E-8, -8.19564079E-8, 1.00000119, -1.41561088E-7, 5.96046519E-8, -1.41561088E-7, 1.00000024))
3877
  AHandleL = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "AHandleL", Vector3.new(0.800000072, 0.800000012, 1.22000003))
3878
  AHandleLWeld = CFuncs.Weld.Create(m, LeftArm, AHandleL, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.210014343, 0.00999736786, 1.14440918E-5, -1, 8.19564079E-8, -5.96046519E-8, -8.19564079E-8, 1.00000119, -1.41561088E-7, -5.96046519E-8, 1.41561088E-7, -1.00000024))
3879
  HitboxL = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "HitboxL", Vector3.new(0.800000072, 0.800000012, 1.22000003))
3880
  HitboxLWeld = CFuncs.Weld.Create(m, AHandleL, HitboxL, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0, 0.700003624, 0, 1, 8.19564079E-8, 5.96046519E-8, 8.19564079E-8, 1.00000119, 1.41561088E-7, 5.96046519E-8, 1.41561088E-7, 1.00000024))
3881
3882
3883
--[[
3884
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.300000012, 0.200000003, 0.200000003))
3885
  PartWeld = CFuncs.Weld.Create(m, AHandleL, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.149986267, 0.200001717, -0.360012054, 1, 8.19564079E-8, 5.96046519E-8, 8.19564079E-8, 1.00000119, 1.41561088E-7, 5.96046519E-8, 1.41561088E-7, 1.00000024))
3886
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.200000003, 0.699999928, 0.520000041))
3887
  PartWeld = CFuncs.Weld.Create(m, AHandleL, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.199989319, -0.0499982834, -9.53674316E-6, 1, 8.19564079E-8, 5.96046519E-8, 8.19564079E-8, 1.00000119, 1.41561088E-7, 5.96046519E-8, 1.41561088E-7, 1.00000024))
3888
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.300000012, 0.200000003, 0.200000003))
3889
  PartWeld = CFuncs.Weld.Create(m, AHandleL, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.149986267, 0.200001717, 0.359992981, 1, 8.19564079E-8, 5.96046519E-8, 8.19564079E-8, 1.00000119, 1.41561088E-7, 5.96046519E-8, 1.41561088E-7, 1.00000024))
3890
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(1.20000005, 0.800000012, 1.20000005))
3891
  PartWeld = CFuncs.Weld.Create(m, AHandleL, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.21005249, -0.81000042, 2.28881836E-5, -1, -8.19564079E-8, -5.96046519E-8, 8.19564079E-8, 1.00000119, 1.41561088E-7, -5.96046519E-8, -1.41561088E-7, -1.00000024))
3892
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.200000003, 0.899999976, 1.01999998))
3893
  PartWeld = CFuncs.Weld.Create(m, AHandleL, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0.0999984741, 0.550003052, -5.7220459E-6, 1, 8.19564079E-8, 5.96046519E-8, 8.19564079E-8, 1.00000119, 1.41561088E-7, 5.96046519E-8, 1.41561088E-7, 1.00000024))
3894
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.200000003, 0.699999988, 1.01999998))
3895
  PartWeld = CFuncs.Weld.Create(m, AHandleL, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0.299995422, 0.650003433, -3.81469727E-6, 1, 8.19564079E-8, 5.96046519E-8, 8.19564079E-8, 1.00000119, 1.41561088E-7, 5.96046519E-8, 1.41561088E-7, 1.00000024))
3896
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.300000012, 0.699999988, 1.01999998))
3897
  PartWeld = CFuncs.Weld.Create(m, AHandleL, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.149993896, 0.65000248, 0, 1, 8.19564079E-8, 5.96046519E-8, 8.19564079E-8, 1.00000119, 1.41561088E-7, 5.96046519E-8, 1.41561088E-7, 1.00000024))
3898
  LHandleR = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "LHandleR", Vector3.new(1.02999997, 1.00999999, 1.19000006))
3899
  LHandleRWeld = CFuncs.Weld.Create(m, RightLeg, LHandleR, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0.00498962402, -0.0950021744, 0.00499534607, -1, 8.19564079E-8, -5.96046519E-8, -8.19564079E-8, 1.00000119, -1.41561088E-7, -5.96046519E-8, 1.41561088E-7, -1.00000024))
3900
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.800000012, 0.800000012, 0.200000003))
3901
  PartWeld = CFuncs.Weld.Create(m, LHandleR, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.00498962402, -0.00499916077, -0.604999542, 1, 8.19564079E-8, 5.96046519E-8, 8.19564079E-8, 1.00000119, 1.41561088E-7, 5.96046519E-8, 1.41561088E-7, 1.00000024))
3902
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(1.02999997, 1.00999999, 1.19000006))
3903
  PartWeld = CFuncs.Weld.Create(m, LHandleR, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0, 0.600002289, 0, 1, 8.19564079E-8, 5.96046519E-8, 8.19564079E-8, 1.00000119, 1.41561088E-7, 5.96046519E-8, 1.41561088E-7, 1.00000024))
3904
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(1.02999997, 0.699999928, 1.19000006))
3905
  PartWeld = CFuncs.Weld.Create(m, LHandleR, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0, -0.454998016, 0, 1, 8.19564079E-8, 5.96046519E-8, 8.19564079E-8, 1.00000119, 1.41561088E-7, 5.96046519E-8, 1.41561088E-7, 1.00000024))
3906
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.400000006, 1.20000005, 0.200000003))
3907
  PartWeld = CFuncs.Weld.Create(m, LHandleR, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.00499725342, -0.00499916077, -0.604999542, 1, 8.19564079E-8, 5.96046519E-8, 8.19564079E-8, 1.00000119, 1.41561088E-7, 5.96046519E-8, 1.41561088E-7, 1.00000024))
3908
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.800000131, 1.20000005, 0.800000012))
3909
  PartWeld = CFuncs.Weld.Create(m, LHandleR, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0.00499725342, 0.0149993896, 0.00500297546, 2.28095047E-7, 1.00000775, 2.99581131E-7, -1.00000417, 5.63755016E-8, -4.06898749E-7, -2.98379774E-7, 2.07959161E-8, 1.0000037))
3910
  CFuncs.Mesh.Create("CylinderMesh", Part, "", "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
3911
  Wedge = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Wedge", Vector3.new(0.200000003, 0.200000003, 0.200000003))
3912
  WedgeWeld = CFuncs.Weld.Create(m, LHandleR, Wedge, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0.604999542, -0.504998207, 0.29499054, -2.98023224E-8, -6.70552254E-8, -1.00000012, 3.7252903E-8, 1.0000006, 7.4505806E-8, 1, 4.47034836E-8, 2.98023224E-8))
3913
  CFuncs.Mesh.Create("SpecialMesh", Wedge, Enum.MeshType.Wedge, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
3914
  Wedge = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Wedge", Vector3.new(0.200000003, 0.200000003, 0.200000003))
3915
  WedgeWeld = CFuncs.Weld.Create(m, LHandleR, Wedge, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0.60499382, -0.495001793, 0.305000305, -5.96046519E-8, -1.41561088E-7, -1.00000024, -8.19564079E-8, -1.00000119, -1.41561088E-7, -1, -8.19564079E-8, -5.96046519E-8))
3916
  CFuncs.Mesh.Create("SpecialMesh", Wedge, Enum.MeshType.Wedge, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
3917
  Wedge = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Wedge", Vector3.new(0.200000003, 0.200000003, 0.200000003))
3918
  WedgeWeld = CFuncs.Weld.Create(m, LHandleR, Wedge, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.604999542, -0.495001793, 0.29499054, 2.98023224E-8, 6.70552254E-8, 1.00000012, -3.7252903E-8, -1.0000006, -7.4505806E-8, 1, 4.47034836E-8, 2.98023224E-8))
3919
  CFuncs.Mesh.Create("SpecialMesh", Wedge, Enum.MeshType.Wedge, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
3920
  Wedge = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Wedge", Vector3.new(0.200000003, 0.200000003, 0.200000003))
3921
  WedgeWeld = CFuncs.Weld.Create(m, LHandleR, Wedge, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.604999542, -0.504998207, 0.305000305, 2.98023224E-8, 6.70552254E-8, 1.00000012, 3.7252903E-8, 1.0000006, 7.4505806E-8, -1, -4.47034836E-8, -2.98023224E-8))
3922
  CFuncs.Mesh.Create("SpecialMesh", Wedge, Enum.MeshType.Wedge, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
3923
  LHandleL = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "LHandleL", Vector3.new(1.02999997, 1.00999999, 1.19000006))
3924
  LHandleLWeld = CFuncs.Weld.Create(m, LeftLeg, LHandleL, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0.00498199463, -0.095000267, 0.00502204895, -1, 8.19564079E-8, -5.96046519E-8, -8.19564079E-8, 1.00000119, -1.41561088E-7, -5.96046519E-8, 1.41561088E-7, -1.00000024))
3925
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(1.02999997, 1.00999999, 1.19000006))
3926
  PartWeld = CFuncs.Weld.Create(m, LHandleL, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0, 0.600001335, 0, 1, 8.19564079E-8, 5.96046519E-8, 8.19564079E-8, 1.00000119, 1.41561088E-7, 5.96046519E-8, 1.41561088E-7, 1.00000024))
3927
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.400000006, 1.20000005, 0.300000012))
3928
  PartWeld = CFuncs.Weld.Create(m, LHandleL, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.00499725342, -0.00500106812, -0.554998398, 1, 8.19564079E-8, 5.96046519E-8, 8.19564079E-8, 1.00000119, 1.41561088E-7, 5.96046519E-8, 1.41561088E-7, 1.00000024))
3929
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(1.02999997, 0.699999928, 1.19000006))
3930
  PartWeld = CFuncs.Weld.Create(m, LHandleL, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0, -0.454999924, 0, 1, 8.19564079E-8, 5.96046519E-8, 8.19564079E-8, 1.00000119, 1.41561088E-7, 5.96046519E-8, 1.41561088E-7, 1.00000024))
3931
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.800000131, 1.20000005, 0.800000012))
3932
  PartWeld = CFuncs.Weld.Create(m, LHandleL, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0.00499534607, 0.0149993896, 0.00500297546, 2.28095047E-7, 1.00000775, 2.99581131E-7, -1.00000417, 5.63755016E-8, -4.06898749E-7, -2.98379774E-7, 2.07959161E-8, 1.0000037))
3933
  CFuncs.Mesh.Create("CylinderMesh", Part, "", "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
3934
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.800000012, 0.800000012, 0.300000012))
3935
  PartWeld = CFuncs.Weld.Create(m, LHandleL, Part, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.00498962402, -0.00500106812, -0.554998398, 1, 8.19564079E-8, 5.96046519E-8, 8.19564079E-8, 1.00000119, 1.41561088E-7, 5.96046519E-8, 1.41561088E-7, 1.00000024))
3936
  Wedge = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Wedge", Vector3.new(0.300000012, 0.200000003, 0.200000003))
3937
  WedgeWeld = CFuncs.Weld.Create(m, LHandleL, Wedge, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.554998398, -0.505000114, 0.305000305, 2.98023224E-8, 6.70552254E-8, 1.00000012, 3.7252903E-8, 1.0000006, 7.4505806E-8, -1, -4.47034836E-8, -2.98023224E-8))
3938
  CFuncs.Mesh.Create("SpecialMesh", Wedge, Enum.MeshType.Wedge, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
3939
  Wedge = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Wedge", Vector3.new(0.300000012, 0.200000003, 0.200000003))
3940
  WedgeWeld = CFuncs.Weld.Create(m, LHandleL, Wedge, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0.554998398, -0.505000114, 0.29499054, -2.98023224E-8, -6.70552254E-8, -1.00000012, 3.7252903E-8, 1.0000006, 7.4505806E-8, 1, 4.47034836E-8, 2.98023224E-8))
3941
  CFuncs.Mesh.Create("SpecialMesh", Wedge, Enum.MeshType.Wedge, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
3942
  Wedge = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Wedge", Vector3.new(0.300000012, 0.200000003, 0.200000003))
3943
  WedgeWeld = CFuncs.Weld.Create(m, LHandleL, Wedge, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(-0.554998398, -0.494999886, 0.29499054, 2.98023224E-8, 6.70552254E-8, 1.00000012, -3.7252903E-8, -1.0000006, -7.4505806E-8, 1, 4.47034836E-8, 2.98023224E-8))
3944
  CFuncs.Mesh.Create("SpecialMesh", Wedge, Enum.MeshType.Wedge, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
3945
  Wedge = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Wedge", Vector3.new(0.300000012, 0.200000003, 0.200000003))
3946
  WedgeWeld = CFuncs.Weld.Create(m, LHandleL, Wedge, CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), CFrame.new(0.554998398, -0.494999886, 0.305000305, -5.96046519E-8, -1.41561088E-7, -1.00000024, -8.19564079E-8, -1.00000119, -1.41561088E-7, -1, -8.19564079E-8, -5.96046519E-8))
3947
  CFuncs.Mesh.Create("SpecialMesh", Wedge, Enum.MeshType.Wedge, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
3948
--]]
3949
  Shield = CFuncs.Part.Create(m, "Neon", 0, 0.5, "Pastle brown", "Part", Vector3.new(9.1, 8.5, 0.2))
3950
  CFuncs.Mesh.Create("SpecialMesh", Shield, "FileMesh", "rbxassetid://708292865", Vector3.new(0, 0, 0), Vector3.new(0.04, 0.04, 0.04))
3951
  Shield.Parent = nil
3952
3953
  EffectModel = Create("Model")({Parent = Character, Name = "Effects"})
3954
  Effects = {
3955
    Block = {
3956
      Create = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay, Type)
3957
        local prt = CFuncs.Part.Create(EffectModel, "Neon", 0, 0, brickcolor, "Effect", Vector3.new())
3958
        prt.Anchored = true
3959
        prt.CFrame = cframe
3960
        local msh = CFuncs.Mesh.Create("BlockMesh", prt, "", "", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
3961
        game:GetService("Debris"):AddItem(prt, 10)
3962
        if Type == 1 or Type == nil then
3963
          table.insert(Effects, {
3964
            prt,
3965
            "Block1",
3966
            delay,
3967
            x3,
3968
            y3,
3969
            z3,
3970
            msh
3971
          })
3972
        elseif Type == 2 then
3973
          table.insert(Effects, {
3974
            prt,
3975
            "Block2",
3976
            delay,
3977
            x3,
3978
            y3,
3979
            z3,
3980
            msh
3981
          })
3982
        end
3983
      end
3984
    },
3985
    Cylinder = {
3986
      Create = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay)
3987
        local prt = CFuncs.Part .. Create(EffectModel, "Neon", 0, 0, brickcolor, "Effect", Vector3.new(0.2, 0.2, 0.2))
3988
        prt.Anchored = true
3989
        prt.CFrame = cframe
3990
        local msh = CFuncs.Mesh.Create("CylinderMesh", prt, "", "", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
3991
        game:GetService("Debris"):AddItem(prt, 2)
3992
        Effects[#Effects + 1] = {
3993
          prt,
3994
          "Cylinder",
3995
          delay,
3996
          x3,
3997
          y3,
3998
          z3
3999
        }
4000
      end
4001
    },
4002
    Head = {
4003
      Create = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay)
4004
        local prt = CFuncs.Part.Create(EffectModel, "Neon", 0, 0, brickcolor, "Effect", Vector3.new())
4005
        prt.Anchored = true
4006
        prt.CFrame = cframe
4007
        local msh = CFuncs.Mesh.Create("SpecialMesh", prt, "Head", "nil", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
4008
        game:GetService("Debris"):AddItem(prt, 10)
4009
        table.insert(Effects, {
4010
          prt,
4011
          "Cylinder",
4012
          delay,
4013
          x3,
4014
          y3,
4015
          z3,
4016
          msh
4017
        })
4018
      end
4019
    },
4020
    Sphere = {
4021
      Create = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay)
4022
        local prt = CFuncs.Part.Create(EffectModel, "Neon", 0, 0, brickcolor, "Effect", Vector3.new())
4023
        prt.Anchored = true
4024
        prt.CFrame = cframe
4025
        local msh = CFuncs.Mesh.Create("SpecialMesh", prt, "Sphere", "", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
4026
        game:GetService("Debris"):AddItem(prt, 10)
4027
        table.insert(Effects, {
4028
          prt,
4029
          "Cylinder",
4030
          delay,
4031
          x3,
4032
          y3,
4033
          z3,
4034
          msh
4035
        })
4036
      end
4037
    },
4038
    Sphere2 = {
4039
      Create = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay)
4040
        local prt = CFuncs.Part.Create(EffectModel, "Neon", 0, 0, brickcolor, "Effect", Vector3.new())
4041
        prt.Anchored = true
4042
        prt.CFrame = cframe
4043
        local msh = CFuncs.Mesh.Create("SpecialMesh", prt, "Sphere", "", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
4044
        game:GetService("Debris"):AddItem(prt, 10)
4045
        table.insert(Effects, {
4046
          prt,
4047
          "Cylinder",
4048
          delay,
4049
          x3,
4050
          y3,
4051
          z3,
4052
          msh
4053
        })
4054
      end
4055
    },
4056
    Elec = {
4057
      Create = function(cff, x, y, z)
4058
        local prt = CFuncs.Part.Create(EffectModel, "Neon", 0, 0, BrickColor.new("Pastel blue-green"), "Part", Vector3.new(1, 1, 1))
4059
        prt.Anchored = true
4060
        prt.CFrame = cff * CFrame.new(math.random(-x, x), math.random(-y, y), math.random(-z, z))
4061
        prt.CFrame = CFrame.new(prt.Position)
4062
        game:GetService("Debris"):AddItem(prt, 2)
4063
        local xval = math.random() / 2
4064
        local yval = math.random() / 2
4065
        local zval = math.random() / 2
4066
        local msh = CFuncs.Mesh.Create("BlockMesh", prt, "", "", Vector3.new(0, 0, 0), Vector3.new(xval, yval, zval))
4067
        table.insert(Effects, {
4068
          prt,
4069
          "Elec",
4070
          0.1,
4071
          x,
4072
          y,
4073
          z,
4074
          xval,
4075
          yval,
4076
          zval
4077
        })
4078
      end
4079
    },
4080
    Ring = {
4081
      Create = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay)
4082
        local prt = CFuncs.Part.Create(EffectModel, "SmoothPlastic", 0, 0, brickcolor, "Effect", Vector3.new())
4083
        prt.Anchored = true
4084
        prt.CFrame = cframe
4085
        local msh = CFuncs.Mesh.Create("CylinderMesh", prt, "", "", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
4086
        game:GetService("Debris"):AddItem(prt, 10)
4087
        table.insert(Effects, {
4088
          prt,
4089
          "Cylinder",
4090
          delay,
4091
          x3,
4092
          y3,
4093
          z3,
4094
          msh
4095
        })
4096
      end
4097
    },
4098
    Wave = {
4099
      Create = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay)
4100
        local prt = CFuncs.Part.Create(EffectModel, "SmoothPlastic", 0, 0, brickcolor, "Effect", Vector3.new())
4101
        prt.Anchored = true
4102
        prt.CFrame = cframe
4103
        local msh = CFuncs.Mesh.Create("SpecialMesh", prt, "FileMesh", "rbxassetid://20329976", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
4104
        game:GetService("Debris"):AddItem(prt, 10)
4105
        table.insert(Effects, {
4106
          prt,
4107
          "Cylinder",
4108
          delay,
4109
          x3,
4110
          y3,
4111
          z3,
4112
          msh
4113
        })
4114
      end
4115
    },
4116
    Break = {
4117
      Create = function(brickcolor, cframe, x1, y1, z1)
4118
        local prt = CFuncs.Part.Create(EffectModel, "Neon", 0, 0, brickcolor, "Effect", Vector3.new(0.5, 0.5, 0.5))
4119
        prt.Anchored = true
4120
        prt.CFrame = cframe * CFrame.fromEulerAnglesXYZ(math.random(-50, 50), math.random(-50, 50), math.random(-50, 50))
4121
        local msh = CFuncs.Mesh.Create("SpecialMesh", prt, "Sphere", "", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
4122
        local num = math.random(10, 50) / 1000
4123
        game:GetService("Debris"):AddItem(prt, 10)
4124
        table.insert(Effects, {
4125
          prt,
4126
          "Shatter",
4127
          num,
4128
          prt.CFrame,
4129
          math.random() - math.random(),
4130
          0,
4131
          math.random(50, 100) / 100
4132
        })
4133
      end
4134
    },
4135
    Fire = {
4136
      Create = function(brickcolor, cframe, x1, y1, z1, delay)
4137
        local prt = CFuncs.Part.Create(EffectModel, "Neon", 0, 0, brickcolor, "Effect", Vector3.new())
4138
        prt.Anchored = true
4139
        prt.CFrame = cframe
4140
        msh = CFuncs.Mesh.Create("BlockMesh", prt, "", "", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
4141
        game:GetService("Debris"):AddItem(prt, 10)
4142
        table.insert(Effects, {
4143
          prt,
4144
          "Fire",
4145
          delay,
4146
          1,
4147
          1,
4148
          1,
4149
          msh
4150
        })
4151
      end
4152
    },
4153
    FireWave = {
4154
      Create = function(brickcolor, cframe, x1, y1, z1)
4155
        local prt = CFuncs.Part.Create(EffectModel, "Neon", 0, 1, brickcolor, "Effect", Vector3.new())
4156
        prt.Anchored = true
4157
        prt.CFrame = cframe
4158
        msh = CFuncs.Mesh.Create("BlockMesh", prt, "", "", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
4159
        local d = Create("Decal")({
4160
          Parent = prt,
4161
          Texture = "rbxassetid://26356434",
4162
          Face = "Top"
4163
        })
4164
        local d = Create("Decal")({
4165
          Parent = prt,
4166
          Texture = "rbxassetid://26356434",
4167
          Face = "Bottom"
4168
        })
4169
        game:GetService("Debris"):AddItem(prt, 10)
4170
        table.insert(Effects, {
4171
          prt,
4172
          "FireWave",
4173
          1,
4174
          30,
4175
          math.random(400, 600) / 100,
4176
          msh
4177
        })
4178
      end
4179
    },
4180
    Lightning = {
4181
      Create = function(p0, p1, tym, ofs, col, th, tra, last)
4182
        local magz = (p0 - p1).magnitude
4183
        local curpos = p0
4184
        local trz = {
4185
          -ofs,
4186
          ofs
4187
        }
4188
        for i = 1, tym do
4189
          local li = CFuncs.Part.Create(EffectModel, "Neon", 0, tra or 0.4, col, "Ref", Vector3.new(th, th, magz / tym))
4190
          local ofz = Vector3.new(trz[math.random(1, 2)], trz[math.random(1, 2)], trz[math.random(1, 2)])
4191
          local trolpos = CFrame.new(curpos, p1) * CFrame.new(0, 0, magz / tym).p + ofz
4192
          li.Material = "Neon"
4193
          if tym == i then
4194
            local magz2 = (curpos - p1).magnitude
4195
            li.Size = Vector3.new(th, th, magz2)
4196
            li.CFrame = CFrame.new(curpos, p1) * CFrame.new(0, 0, -magz2 / 2)
4197
            table.insert(Effects, {
4198
              li,
4199
              "Disappear",
4200
              last
4201
            })
4202
          else
4203
            li.CFrame = CFrame.new(curpos, trolpos) * CFrame.new(0, 0, magz / tym / 2)
4204
            curpos = li.CFrame * CFrame.new(0, 0, magz / tym / 2).p
4205
            game.Debris:AddItem(li, 10)
4206
            table.insert(Effects, {
4207
              li,
4208
              "Disappear",
4209
              last
4210
            })
4211
          end
4212
        end
4213
      end
4214
    },
4215
    EffectTemplate = {}
4216
  }
4217
  local Invisible = true
4218
  function Reappear()
4219
    for _, i in pairs(AdvancingFortress:children()) do
4220
      if i:IsA("BasePart") then
4221
        coroutine.resume(coroutine.create(function(Part)
4222
          for i = 0, 1, 0.3 do
4223
            swait()
4224
            Part.Transparency = -i
4225
          end
4226
          Part.Transparency = 0
4227
        end), i)
4228
      end
4229
    end
4230
    for _, i in pairs(m:children()) do
4231
      if i:IsA("BasePart") then
4232
        coroutine.resume(coroutine.create(function(Part)
4233
          for i = 0, 1, 0.3 do
4234
            swait()
4235
            Part.Transparency = i
4236
          end
4237
          Part.Transparency = 0
4238
        end), i)
4239
      end
4240
    end
4241
  end
4242
  function ReappearArmorOnly()
4243
    for _, i in pairs(m:children()) do
4244
      if i:IsA("BasePart") then
4245
        coroutine.resume(coroutine.create(function(Part)
4246
          for i = 0, 1, 0.3 do
4247
            swait()
4248
            Part.Transparency = i
4249
          end
4250
          Part.Transparency = 0
4251
		for _,v in pairs(KQ) do
4252
			St=v.Weld.Part1.Name
4253
			if St=='FHead' then
4254
				St='Head'
4255
			end
4256
			v.Weld.Part1=Character[St]
4257
		end
4258
        end), i)
4259
      end
4260
    end
4261
  end
4262
  function Disappear()
4263
    for _, i in pairs(AdvancingFortress:children()) do
4264
      if i:IsA("BasePart") then
4265
        coroutine.resume(coroutine.create(function(Part)
4266
          for i = 0, 1, 0.3 do
4267
            swait()
4268
            Part.Transparency = i
4269
          end
4270
          Part.Transparency = 1
4271
        end), i)
4272
      end
4273
    end
4274
    for _, i in pairs(m:children()) do
4275
      if i:IsA("BasePart") then
4276
        coroutine.resume(coroutine.create(function(Part)
4277
          for i = 0, 1, 0.3 do
4278
            swait()
4279
            Part.Transparency = i
4280
          end
4281
          Part.Transparency = 1
4282
        end), i)
4283
      end
4284
    end
4285
  end
4286
  function DisappearArmorOnly()
4287
    for _, i in pairs(m:children()) do
4288
      if i:IsA("BasePart") then
4289
        coroutine.resume(coroutine.create(function(Part)
4290
          for i = 0, 1, 0.3 do
4291
            swait()
4292
            Part.Transparency = i
4293
          end
4294
          Part.Transparency = 1
4295
		for _,v in pairs(KQ) do
4296
			St=v.Weld.Part1.Name
4297
			if St=='Head' then
4298
			St='FHead'
4299
			end
4300
			v.Weld.Part1=AdvancingFortress[St]
4301
		end
4302
	end), i)
4303
      end
4304
    end
4305
  end
4306
  function CamShake(time, freq)
4307
    coroutine.resume(coroutine.create(function()
4308
      local cam = game:GetService("Workspace").CurrentCamera
4309
      local time = 10
4310
      local seed = Vector3.new(math.random(100, 200) / freq, math.random(100, 200) / freq, 0)
4311
      if math.random(1, 2) == 1 then
4312
        seed = Vector3.new(-seed.x, seed.y, 0)
4313
      end
4314
      if math.random(1, 2) == 1 then
4315
        seed = Vector3.new(seed.x, -seed.y, 0)
4316
      end
4317
      cam.CoordinateFrame = CFrame.new(cam.Focus.p) * (cam.CoordinateFrame - cam.CoordinateFrame.p) * CFrame.fromEulerAnglesXYZ(seed.x * time, seed.y * time, 0) * CFrame.new(0, 0, (cam.CoordinateFrame.p - cam.Focus.p).magnitude)
4318
      for i = 1, time do
4319
        cam.CoordinateFrame = CFrame.new(cam.Focus.p) * (cam.CoordinateFrame - cam.CoordinateFrame.p) * CFrame.fromEulerAnglesXYZ(-seed.x, -seed.y, 0) * CFrame.new(0, 0, (cam.CoordinateFrame.p - cam.Focus.p).magnitude)
4320
        wait()
4321
      end
4322
    end))
4323
  end
4324
  local ora = false
4325
  function ORA()
4326
    attack = true
4327
    local S = CFuncs.Sound.Create("", Torso, 3, 1)
4328
    S.Looped = true
4329
    if ora == true then
4330
      while ora == true do
4331
        CFuncs.Sound.Create("200632136", HitboxL, 0.3, math.random(1, 1.2))
4332
        MagnitudeDamage(HitboxL, 5, 4, 10, 0, "Normal", "260430117", 1)
4333
        for i = 0, 1, 0.8 do
4334
          swait()
4335
          RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1, -4), 0.5)
4336
          PlayAnimationFromTable({
4337
            CFrame.new(-0.561874092, -0.346845925, -0.435822666, 0.64278698, -0.323744029, 0.694272816, 0, 0.906308115, 0.422617555, -0.766044974, -0.271653026, 0.582563102) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4338
            CFrame.new(8.9481473E-6, 1.49999249, 5.2684918E-6, 0.704669476, 0.0560214818, -0.707321048, -0.0868221819, 0.996195257, -0.0075956285, 0.704204142, 0.0667634308, 0.706852198) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4339
            CFrame.new(1.97048378, 0.808467984, -0.254994273, -0.457079947, -0.7819345, 0.423859, 0.842444837, -0.227779076, 0.488266319, -0.285246044, 0.580254436, 0.762849629) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4340
            CFrame.new(-1.18535733, 0.530705392, -0.713678956, 0.778861284, -0.400152355, 0.482962847, 0.492400557, -0.0868335962, -0.866026342, 0.388479888, 0.912325621, 0.129403993) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4341
            CFrame.new(0.708622813, -1.45549953, -0.199998885, 0.984808087, -0.167729571, -0.0449446738, 0.173646823, 0.951251328, 0.254887581, 1.4603138E-6, -0.258819878, 0.965925694) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4342
            CFrame.new(-0.604502141, -1.943735, 5.15520573E-4, 0.982544005, 0.00845471025, 0.185841322, -0.0717865527, 0.938827574, 0.336824685, -0.17162481, -0.34428525, 0.923045695) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
4343
          }, 0.8, false)
4344
        end
4345
        CFuncs.Sound.Create("200632136", HitboxR, 0.3, math.random(1, 1.2))
4346
        MagnitudeDamage(HitboxR, 5, 4, 10, 0, "Normal", "260430117", 1)
4347
        for i = 0, 1, 0.8 do
4348
          swait()
4349
          RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1, -4), 0.5)
4350
          PlayAnimationFromTable({
4351
            CFrame.new(1.1920929E-6, -0.0170394331, -0.52941519, 0.70710516, -2.21270369E-7, -0.707108498, 0.18301405, 0.965925574, 0.183012888, 0.683014154, -0.258820117, 0.683010995) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4352
            CFrame.new(-1.22189522E-6, 1.49999356, 1.04308128E-6, 0.707110465, 0.122788236, 0.696360528, -1.4748274E-6, 0.98480773, -0.173648238, -0.707103193, 0.122787461, 0.696368098) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4353
            CFrame.new(1.44562268, 0.333473027, -0.475224167, 0.907739162, 0.217196256, 0.358959734, 0.40125221, -0.199453548, -0.893991232, -0.122576535, 0.955528319, -0.268199235) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4354
            CFrame.new(-1.884794, 0.881342709, -0.770847201, 0.0912726, 0.688403964, -0.719562054, -0.91795665, -0.221949756, -0.328776807, -0.386037856, 0.690535009, 0.611666858) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4355
            CFrame.new(0.789779902, -1.8586235, 0.161380947, 0.965926766, -0.258817255, -8.10623169E-6, 0.243211254, 0.907672405, 0.342022836, -0.0885141194, -0.330371499, 0.939691722) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4356
            CFrame.new(-0.73783946, -1.45406294, -0.215006173, 0.882573366, -0.0180292428, 0.469829261, -0.163172901, 0.925412893, 0.342031717, -0.440952569, -0.378531486, 0.813802838) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
4357
          }, 0.8, false)
4358
        end
4359
        CFuncs.Sound.Create("200632136", HitboxL, 0.3, math.random(1, 1.2))
4360
        MagnitudeDamage(HitboxL, 5, 4, 10, 0, "Normal", "260430117", 1)
4361
        for i = 0, 1, 0.8 do
4362
          swait()
4363
          RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1, -4), 0.5)
4364
          PlayAnimationFromTable({
4365
            CFrame.new(0.215482175, -0.0393944569, -0.126133978, 0.259671897, -0.351393819, 0.8994959, -0.075478971, 0.921212733, 0.381667405, -0.962742627, -0.167001322, 0.212690249) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4366
            CFrame.new(-1.26510859E-5, 1.49999118, -2.16066837E-7, 0.420251548, -0.0215960592, -0.90715003, -0.100918382, 0.992402375, -0.0703775883, 0.901778162, 0.12112467, 0.414879382) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4367
            CFrame.new(1.81840861, 0.705381036, -0.347923756, -0.236346364, -0.883376777, 0.404705286, 0.945798516, -0.113677993, 0.304209948, -0.222726092, 0.454668403, 0.862362981) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4368
            CFrame.new(-1.21960759, 0.420275182, -0.728423595, -0.57802856, -0.255150676, 0.775100708, 0.665436089, -0.697164714, 0.266751111, 0.472311139, 0.669969678, 0.572767615) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4369
            CFrame.new(0.620917439, -1.53014767, -0.12091887, 0.707106113, 0.241845652, -0.66446346, -1.2293458E-6, 0.939692676, 0.342019886, 0.707107484, -0.241843566, 0.664462805) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4370
            CFrame.new(-0.873213649, -1.89646459, -0.100004375, 0.933012128, 0.353242815, -0.0686147735, -0.258823931, 0.791241407, 0.554028153, 0.249997303, -0.499155849, 0.829665601) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
4371
          }, 0.8, false)
4372
        end
4373
        CFuncs.Sound.Create("200632136", HitboxR, 0.3, math.random(1, 1.2))
4374
        MagnitudeDamage(HitboxR, 5, 4, 10, 0, "Normal", "260430117", 1)
4375
        for i = 0, 1, 0.8 do
4376
          swait()
4377
          RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1, -4), 0.5)
4378
          PlayAnimationFromTable({
4379
            CFrame.new(0.299998224, -0.0468490347, -0.211314023, 0.642786682, -2.87348001E-7, -0.766045272, 0.323744863, 0.906307757, 0.271653205, 0.694272637, -0.42261824, 0.582562685) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4380
            CFrame.new(2.71201134E-6, 1.4999969, 8.94069672E-7, 0.642777503, 0.133020476, 0.754416466, 4.31999706E-6, 0.984809279, -0.173647597, -0.766052961, 0.111620098, 0.633012772) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4381
            CFrame.new(1.27057993, 0.327670783, -0.599993467, 0.638493001, 0.280156553, -0.716825664, -0.769049883, 0.196164608, -0.608343422, -0.0298155248, 0.939697862, 0.340704083) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4382
            CFrame.new(-1.86040878, 1.02262986, -0.452570885, 0.386218816, 0.717701018, -0.579433978, -0.403004408, -0.433759809, -0.805879354, -0.829712272, 0.544763446, 0.121709965) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4383
            CFrame.new(0.779964924, -1.75316048, -0.0263362825, 0.826099217, -0.36394459, 0.43023771, 0.181541473, 0.894650102, 0.40822047, -0.533481896, -0.259124577, 0.805140793) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4384
            CFrame.new(-0.724003315, -1.47219872, -0.266945302, 0.766038954, -0.166370958, 0.620890498, 4.09781933E-6, 0.965925932, 0.258819997, -0.642794192, -0.198263675, 0.739937425) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
4385
          }, 0.8, false)
4386
        end
4387
        CFuncs.Sound.Create("200632136", HitboxL, 0.3, math.random(1, 1.2))
4388
        MagnitudeDamage(HitboxL, 5, 4, 10, 0, "Normal", "260430117", 1)
4389
      end
4390
    end
4391
    S:Stop()
4392
    local S2 = CFuncs.Sound.Create("", Torso, 1.5, 1)
4393
    for i = 0, 1, 0.13 do
4394
      swait()
4395
      RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1, -3), 0.5)
4396
      PlayAnimationFromTable({
4397
        CFrame.new(2.68220901E-6, -0.0739577487, 0.0232374109, 0.707105994, -3.47710994E-7, -0.707107604, -0.122787997, 0.98480767, -0.122788213, 0.696364999, 0.173648596, 0.696363389) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4398
        CFrame.new(-5.36441803E-7, 1.49999356, -1.28149986E-6, 0.707105994, -0.122788511, 0.696365297, -3.47710994E-7, 0.984808028, 0.173649326, -0.707107604, -0.122788727, 0.696363688) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4399
        CFrame.new(1.13747835, 0.382733107, -0.729447305, 0.579597414, 0.772029877, -0.260839432, -0.351051509, -0.0523141921, -0.934893906, -0.735411942, 0.633429527, 0.240701318) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4400
        CFrame.new(-1.53455412, 0.605712295, -0.542039633, 0.786121905, 0.427828372, -0.446066588, -0.606968522, 0.398195386, -0.687771559, -0.116626531, 0.811420619, 0.572708428) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4401
        CFrame.new(0.903839946, -1.70734286, 0.373858094, 0.863655448, -0.430708885, 0.261895239, 0.187955216, 0.757234871, 0.625514567, -0.46773085, -0.491004646, 0.734943748) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4402
        CFrame.new(-0.596739769, -1.62411702, -0.0967329144, 0.725493789, -0.291957259, 0.623233199, -0.081900157, 0.86250174, 0.499382436, -0.683338165, -0.41334182, 0.601828396) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
4403
      }, 0.2, false)
4404
    end
4405
    CFuncs.Sound.Create("471881954", HitboxR, 1, 1)
4406
    MagnitudeDamage(HitboxR, 7, 10, 15, 50, "Normal", "610359590", 1)
4407
    for i = 0, 1, 0.1 do
4408
      swait()
4409
      RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1, -5), 0.3)
4410
      PlayAnimationFromTable({
4411
        CFrame.new(-0.338160992, -0.0772590488, -0.484170675, 0.307024002, -0.153706044, 0.939207554, -0.403236002, 0.872901201, 0.274671286, -0.86205399, -0.463052958, 0.206021816) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4412
        CFrame.new(-0.0502282679, 1.50051379, -0.0864891857, 0.502356887, -0.246090144, -0.828901231, -0.00520065427, 0.957766473, -0.287500501, 0.864644766, 0.148738697, 0.479860842) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4413
        CFrame.new(1.81698525, 1.20575511, -0.168038458, 0.0800605565, -0.859217465, 0.505307972, 0.457053572, -0.418860257, -0.784640014, 0.885828495, 0.293771386, 0.359173566) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4414
        CFrame.new(-1.66351938, 0.691055655, 0.203685582, 0.309526145, 0.793331623, -0.524231553, -0.937197804, 0.347743452, -0.0271089375, 0.160791725, 0.499699503, 0.851144433) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4415
        CFrame.new(0.971616864, -1.6145575, 0.096719563, 0.544056833, -0.203144252, -0.814085484, 0.51142931, 0.849463344, 0.129818588, 0.665161908, -0.486975014, 0.566052973) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4416
        CFrame.new(-0.676943898, -1.44413579, 0.206094518, 0.884253025, 0.0570309162, -0.463512957, 0.209485695, 0.838620007, 0.502824426, 0.417387724, -0.541723251, 0.729605079) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
4417
      }, 0.6, false)
4418
    end
4419
    attack = false
4420
  end
4421
  function CastleCrusherFist()
4422
    attack = true
4423
    STDamage = true
4424
    local S2 = CFuncs.Sound.Create("", Torso, 1, 1)
4425
    for i = 0, 1, 0.1 do
4426
      swait()
4427
      Effects.Block.Create(BrickColor.new("Pastel blue-green"), HitboxR.CFrame, 1, 1, 1, 4, 4, 4, 0.3, 1)
4428
      Effects.Break.Create(BrickColor.new("Pastel blue-green"), HitboxR.CFrame, 0.5, 0.5, 0.5)
4429
      RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1, -2), 0.2)
4430
      PlayAnimationFromTable({
4431
        CFrame.new(-5.99771738E-7, -0.00717129931, 0.169464022, 0.422617912, -2.2671E-7, -0.906308055, -0.309975952, 0.939692557, -0.144544229, 0.851650834, 0.342020661, 0.397130787) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4432
        CFrame.new(-0.0102166235, 1.52751005, -0.239579424, 0.456926107, -0.171424359, 0.872835577, -0.167732254, 0.94705075, 0.273807496, -0.87355268, -0.271512181, 0.403976858) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4433
        CFrame.new(0.944673777, 0.474064022, -0.539126158, 0.229199454, 0.762564063, 0.604949772, 0.809601307, 0.195682317, -0.553402781, -0.540382624, 0.616607308, -0.572522938) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4434
        CFrame.new(-1.61232829, 0.309644789, -0.24482432, 0.455398798, 0.536860108, -0.710207343, -0.887026072, 0.205374956, -0.413530886, -0.076149486, 0.818293095, 0.569735885) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4435
        CFrame.new(1.08113468, -1.48232126, 0.656104684, 0.81421864, -0.517612338, 0.262917578, 0.175395042, 0.651024699, 0.738514543, -0.553430021, -0.555197835, 0.620862961) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4436
        CFrame.new(-0.427128136, -1.50760674, -0.0473105907, 0.804508269, -0.373179317, 0.462065101, -0.173640698, 0.596196175, 0.783836842, -0.567992628, -0.71083647, 0.414845526) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
4437
      }, 0.2, false)
4438
    end
4439
    MagnitudeDamage(HitboxR, 10, 50, 80, 100, "Normal", "610359515", 1)
4440
    Effects.Wave.Create(BrickColor.new("Pastel blue-green"), RootPart.CFrame * CFrame.Angles(math.rad(90), math.rad(0), math.rad(0)), 0.5, 0.5, 0.5, 0.6, 0.6, 0.6, 0.06)
4441
    CFuncs.Sound.Create("471881980", HitboxR, 1, 0.9)
4442
    CFuncs.Sound.Create("471881954", HitboxR, 1, 0.8)
4443
    for i = 0, 1, 0.08 do
4444
      swait()
4445
      Effects.Block.Create(BrickColor.new("Pastel blue-green"), HitboxR.CFrame, 1, 1, 1, 4, 4, 4, 0.3, 1)
4446
      Effects.Break.Create(BrickColor.new("Pastel blue-green"), HitboxR.CFrame, 0.5, 0.5, 0.5)
4447
      RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1, -5), 0.3)
4448
      PlayAnimationFromTable({
4449
        CFrame.new(-3.57627869E-7, -0.116980031, -2.22140098, 0.342020035, -6.11579551E-8, 0.939692736, -0.604023039, 0.766044259, 0.219846413, -0.71984607, -0.642787933, 0.262002468) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4450
        CFrame.new(-1.13248825E-6, 1.49999046, 8.94069672E-7, 0.422608167, -0.383014679, -0.82140249, -1.36196613E-5, 0.906310022, -0.422613323, 0.906312764, 0.17861104, 0.383008778) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4451
        CFrame.new(1.72490048, 1.25688744, -0.021425128, -0.678134382, -0.731868863, 0.0670941696, 0.667953849, -0.575675249, 0.47163111, -0.306547582, 0.364645123, 0.879239857) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4452
        CFrame.new(-1.70565486, 0.469353855, 0.162862837, 0.82686162, 0.55728358, 0.0757693052, -0.414878726, 0.513436973, 0.751176, 0.379712611, -0.652546048, 0.655748963) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4453
        CFrame.new(0.757160306, -1.48393714, -0.193787217, 0.601814985, 0.305624545, -0.737842917, -2.98023224E-8, 0.923879623, 0.382683486, 0.798635662, -0.230304718, 0.556004763) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4454
        CFrame.new(-0.908789515, -1.60188651, -0.0663503706, 0.696367741, 0.548584938, -0.462741733, -0.173660636, 0.7544052, 0.633021533, 0.696362019, -0.360454619, 0.620610356) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
4455
      }, 0.6, false)
4456
    end
4457
    STDamage = false
4458
    attack = false
4459
  end
4460
  function CastleCrusherFist()
4461
    attack = true
4462
    STDamage = true
4463
    local S2 = CFuncs.Sound.Create("", Torso, 1, 1)
4464
    for i = 0, 1, 0.1 do
4465
      swait()
4466
      Effects.Block.Create(BrickColor.new("Pastel blue-green"), HitboxR.CFrame, 1, 1, 1, 4, 4, 4, 0.3, 1)
4467
      Effects.Break.Create(BrickColor.new("Pastel blue-green"), HitboxR.CFrame, 0.5, 0.5, 0.5)
4468
      RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1, -2), 0.5)
4469
      PlayAnimationFromTable({
4470
        CFrame.new(-5.99771738E-7, -0.00717129931, 0.169464022, 0.422617912, -2.2671E-7, -0.906308055, -0.309975952, 0.939692557, -0.144544229, 0.851650834, 0.342020661, 0.397130787) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4471
        CFrame.new(-0.0102166235, 1.52751005, -0.239579424, 0.456926107, -0.171424359, 0.872835577, -0.167732254, 0.94705075, 0.273807496, -0.87355268, -0.271512181, 0.403976858) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4472
        CFrame.new(0.944673777, 0.474064022, -0.539126158, 0.229199454, 0.762564063, 0.604949772, 0.809601307, 0.195682317, -0.553402781, -0.540382624, 0.616607308, -0.572522938) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4473
        CFrame.new(-1.61232829, 0.309644789, -0.24482432, 0.455398798, 0.536860108, -0.710207343, -0.887026072, 0.205374956, -0.413530886, -0.076149486, 0.818293095, 0.569735885) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4474
        CFrame.new(1.08113468, -1.48232126, 0.656104684, 0.81421864, -0.517612338, 0.262917578, 0.175395042, 0.651024699, 0.738514543, -0.553430021, -0.555197835, 0.620862961) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4475
        CFrame.new(-0.427128136, -1.50760674, -0.0473105907, 0.804508269, -0.373179317, 0.462065101, -0.173640698, 0.596196175, 0.783836842, -0.567992628, -0.71083647, 0.414845526) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
4476
      }, 0.2, false)
4477
    end
4478
    Effects.Wave.Create(BrickColor.new("Pastel blue-green"), RootPart.CFrame * CFrame.Angles(math.rad(90), math.rad(0), math.rad(0)), 0.5, 0.5, 0.5, 0.6, 0.6, 0.6, 0.06)
4479
    Character.HumanoidRootPart.Velocity = Character.HumanoidRootPart.CFrame.lookVector * 140
4480
    CFuncs.Sound.Create("471881980", HitboxR, 1, 0.9)
4481
    CFuncs.Sound.Create("471881954", HitboxR, 1, 0.8)
4482
    for i = 0, 1, 0.08 do
4483
      swait()
4484
      MagnitudeDamage(HitboxR, 5, 50, 80, 100, "Normal", "610359515", 1)
4485
      Effects.Block.Create(BrickColor.new("Pastel blue-green"), HitboxR.CFrame, 1, 1, 1, 4, 4, 4, 0.3, 1)
4486
      Effects.Break.Create(BrickColor.new("Pastel blue-green"), HitboxR.CFrame, 0.5, 0.5, 0.5)
4487
      RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1, -5), 1)
4488
      PlayAnimationFromTable({
4489
        CFrame.new(-3.57627869E-7, -0.116980031, -2.22140098, 0.342020035, -6.11579551E-8, 0.939692736, -0.604023039, 0.766044259, 0.219846413, -0.71984607, -0.642787933, 0.262002468) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4490
        CFrame.new(-1.13248825E-6, 1.49999046, 8.94069672E-7, 0.422608167, -0.383014679, -0.82140249, -1.36196613E-5, 0.906310022, -0.422613323, 0.906312764, 0.17861104, 0.383008778) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4491
        CFrame.new(1.72490048, 1.25688744, -0.021425128, -0.678134382, -0.731868863, 0.0670941696, 0.667953849, -0.575675249, 0.47163111, -0.306547582, 0.364645123, 0.879239857) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4492
        CFrame.new(-1.70565486, 0.469353855, 0.162862837, 0.82686162, 0.55728358, 0.0757693052, -0.414878726, 0.513436973, 0.751176, 0.379712611, -0.652546048, 0.655748963) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4493
        CFrame.new(0.757160306, -1.48393714, -0.193787217, 0.601814985, 0.305624545, -0.737842917, -2.98023224E-8, 0.923879623, 0.382683486, 0.798635662, -0.230304718, 0.556004763) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4494
        CFrame.new(-0.908789515, -1.60188651, -0.0663503706, 0.696367741, 0.548584938, -0.462741733, -0.173660636, 0.7544052, 0.633021533, 0.696362019, -0.360454619, 0.620610356) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
4495
      }, 0.6, false)
4496
    end
4497
    STDamage = false
4498
    attack = false
4499
  end
4500
4501
4502
distance2__=0
4503
AdvancingFortress.FHead.face:remove()
4504
4505
function Lattack()
4506
    attack = true
4507
    local S = CFuncs.Sound.Create("", Torso, 3, 1)
4508
    S.Looped = true
4509
    if Long then
4510
      while Long and distance2__>-15 do-- max range
4511
	distance2__=distance2__-1
4512
4513
        for i = 0, 1, 0.8 do
4514
          swait()
4515
          RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1, distance2__), 0.5)
4516
          PlayAnimationFromTable({
4517
            CFrame.new(-0.561874092, -0.346845925, -0.435822666, 0.64278698, -0.323744029, 0.694272816, 0, 0.906308115, 0.422617555, -0.766044974, -0.271653026, 0.582563102) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4518
            CFrame.new(8.9481473E-6, 1.49999249, 5.2684918E-6, 0.704669476, 0.0560214818, -0.707321048, -0.0868221819, 0.996195257, -0.0075956285, 0.704204142, 0.0667634308, 0.706852198) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4519
            CFrame.new(1.97048378, 0.808467984, -0.254994273, -0.457079947, -0.7819345, 0.423859, 0.842444837, -0.227779076, 0.488266319, -0.285246044, 0.580254436, 0.762849629) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4520
            CFrame.new(-1.18535733, 0.530705392, -0.713678956, 0.778861284, -0.400152355, 0.482962847, 0.492400557, -0.0868335962, -0.866026342, 0.388479888, 0.912325621, 0.129403993) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4521
            CFrame.new(0.708622813, -1.45549953, -0.199998885, 0.984808087, -0.167729571, -0.0449446738, 0.173646823, 0.951251328, 0.254887581, 1.4603138E-6, -0.258819878, 0.965925694) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4522
            CFrame.new(-0.604502141, -1.943735, 5.15520573E-4, 0.982544005, 0.00845471025, 0.185841322, -0.0717865527, 0.938827574, 0.336824685, -0.17162481, -0.34428525, 0.923045695) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
4523
          }, 0.8, false)
4524
        end
4525
4526
end
4527
        for i = 0, 1, 0.8 do
4528
          swait()
4529
          PlayAnimationFromTable({
4530
            CFrame.new(-0.561874092, -0.346845925, -0.435822666, 0.64278698, -0.323744029, 0.694272816, 0, 0.906308115, 0.422617555, -0.766044974, -0.271653026, 0.582563102) * CFrame.new(0, 0, 0) * CFrame.Angles(0, -1, 0),
4531
            CFrame.new(8.9481473E-6, 1.49999249, 5.2684918E-6, 0.704669476, 0.0560214818, -0.707321048, -0.0868221819, 0.996195257, -0.0075956285, 0.704204142, 0.0667634308, 0.706852198) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4532
            CFrame.new(1.97048378, 0.808467984, -0.254994273, -0.457079947, -0.7819345, 0.423859, 0.842444837, -0.227779076, 0.488266319, -0.285246044, 0.580254436, 0.762849629) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4533
            CFrame.new(-1.18535733, 0.530705392, -0.713678956, 0.778861284, -0.400152355, 0.482962847, 0.492400557, -0.0868335962, -0.866026342, 0.388479888, 0.912325621, 0.129403993) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4534
            CFrame.new(0.708622813, -1.45549953, -0.199998885, 0.984808087, -0.167729571, -0.0449446738, 0.173646823, 0.951251328, 0.254887581, 1.4603138E-6, -0.258819878, 0.965925694) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4535
            CFrame.new(-0.604502141, -1.943735, 5.15520573E-4, 0.982544005, 0.00845471025, 0.185841322, -0.0717865527, 0.938827574, 0.336824685, -0.17162481, -0.34428525, 0.923045695) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
4536
          }, 0.8, false)
4537
        end
4538
        CFuncs.Sound.Create("200632136", HitboxL, 0.3, math.random(1, 1.2))
4539
        MagnitudeDamage(HitboxL, 5, 4, 50, 0, "Normal", "260430117", 1)
4540
 PlayAnimationFromTable({
4541
            CFrame.new(-0.561874092, -0.346845925, -0.435822666, 0.64278698, -0.323744029, 0.694272816, 0, 0.906308115, 0.422617555, -0.766044974, -0.271653026, 0.582563102) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 1, 0),
4542
            CFrame.new(8.9481473E-6, 1.49999249, 5.2684918E-6, 0.704669476, 0.0560214818, -0.707321048, -0.0868221819, 0.996195257, -0.0075956285, 0.704204142, 0.0667634308, 0.706852198) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4543
            CFrame.new(1.97048378, 0.808467984, -0.254994273, -0.457079947, -0.7819345, 0.423859, 0.842444837, -0.227779076, 0.488266319, -0.285246044, 0.580254436, 0.762849629) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4544
            CFrame.new(-1.18535733, 0.530705392, -0.713678956, 0.778861284, -0.400152355, 0.482962847, 0.492400557, -0.0868335962, -0.866026342, 0.388479888, 0.912325621, 0.129403993) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4545
            CFrame.new(0.708622813, -1.45549953, -0.199998885, 0.984808087, -0.167729571, -0.0449446738, 0.173646823, 0.951251328, 0.254887581, 1.4603138E-6, -0.258819878, 0.965925694) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4546
            CFrame.new(-0.604502141, -1.943735, 5.15520573E-4, 0.982544005, 0.00845471025, 0.185841322, -0.0717865527, 0.938827574, 0.336824685, -0.17162481, -0.34428525, 0.923045695) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
4547
          }, 0.8, false)
4548
        end
4549
wait(1)
4550
distance2__=0
4551
    STDamage = false
4552
    attack = false
4553
  end
4554
4555
4556
4557
4558
  function weld5(part0, part1, c0, c1)
4559
    local weeld = Instance.new("Weld", part0)
4560
    weeld.Part0 = part0
4561
    weeld.Part1 = part1
4562
    weeld.C0 = c0
4563
    weeld.C1 = c1
4564
    return weeld
4565
  end
4566
  local Grab = false
4567
  function GRABEMBOIGRABEM()
4568
    attack = true
4569
    gp = nil
4570
    con1 = HitboxR.Touched:connect(function(hit)
4571
      local ht = hit.Parent
4572
      local hum1 = ht:FindFirstChild("Humanoid")
4573
      if Grab == false then
4574
        if hum1 ~= nil and hit.Parent ~= Character then
4575
          hum1.PlatformStand = true
4576
          gp = ht
4577
          Grab = true
4578
          local asd = weld5(RightArm, ht:FindFirstChild("Torso"), CFrame.new(0, -1.5, 0), CFrame.new(0, 0, 0))
4579
          asd.Parent = RightArm
4580
          asd.Name = "asd"
4581
          asd.C0 = asd.C0 * CFrame.Angles(math.rad(-90), 0, 0)
4582
          CFuncs.Sound.Create("200632821", Torso, 1, 1)
4583
        elseif hum1 == nil then
4584
          con1:disconnect()
4585
          wait()
4586
          return
4587
        end
4588
      end
4589
    end)
4590
    for i = 0, 1, 0.2 do
4591
      swait()
4592
      RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1, -2), 0.3)
4593
      PlayAnimationFromTable({
4594
        CFrame.new(-1.08022243E-4, -0.233785003, -0.0873367637, 0.499999821, -1.78813863E-7, -0.866025507, 0.150383934, 0.984807789, 0.0868239477, 0.852868676, -0.173648283, 0.492403716) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4595
        CFrame.new(-1.2665987E-7, 1.49999368, -1.02072954E-6, 0.573575675, 0.0713936985, 0.816035628, -5.01982868E-7, 0.996194899, -0.0871551931, -0.819152594, 0.049989678, 0.571393132) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4596
        CFrame.new(1.47017705, 0.884583473, 0.0280318335, 0.886720777, -0.205462068, 0.414139926, 0.236241817, -0.568640172, -0.787933052, 0.397386849, 0.796513736, -0.455686152) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4597
        CFrame.new(-1.76647317, 0.409804255, -0.03838256, 0.444113791, 0.836516619, -0.320940912, -0.836516619, 0.258818626, -0.482962757, -0.320940822, 0.482962757, 0.814704895) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4598
        CFrame.new(0.838749349, -1.98392951, 0.15807499, 0.830397308, -0.277826965, 0.48296237, 0.167731524, 0.951251447, 0.258818328, -0.53132534, -0.133914024, 0.836516857) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4599
        CFrame.new(-0.811016142, -1.63281643, -0.179561377, 0.642214835, 0.00870995224, 0.76647532, -0.0151349902, 0.999884725, 0.00131897628, -0.766375303, -0.0124476701, 0.642272472) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
4600
      }, 0.3, false)
4601
    end
4602
    for i = 0, 1, 0.1 do
4603
      swait()
4604
      RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1, -6), 0.3)
4605
      PlayAnimationFromTable({
4606
        CFrame.new(0.159273595, -0.292363107, -0.115490548, 0.0844330043, -0.144068986, 0.985959053, -0.357129037, 0.919379771, 0.164923266, -0.930231094, -0.366039604, 0.0261747837) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4607
        CFrame.new(4.81307507E-6, 1.49999106, -3.65450978E-6, 0.171444774, -0.100317284, -0.980072975, -0.0616287738, 0.991762042, -0.11229457, 0.983264267, 0.0796530023, 0.163850009) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4608
        CFrame.new(1.73932612, 1.06159639, 0.141945362, -0.153680667, -0.913934886, 0.375639945, 0.659919798, -0.377877831, -0.649395287, 0.735450923, 0.148092732, 0.661196351) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4609
        CFrame.new(-1.68730593, 0.429691374, -0.418232322, 0.633863091, 0.519853055, -0.57268703, -0.772902489, 0.453472316, -0.443829596, 0.028971523, 0.723958433, 0.689235032) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4610
        CFrame.new(0.51381135, -1.74729896, 0.0663300753, 0.422899842, 0.615153313, -0.665388703, -0.0435856879, 0.747240186, 0.66312325, 0.905127704, -0.251433372, 0.342819571) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4611
        CFrame.new(-0.991570175, -1.5009346, -0.1830419, 0.415304065, 0.586875141, -0.695054054, -0.166150108, 0.800146103, 0.576333642, 0.894380629, -0.123870395, 0.429813296) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
4612
      }, 0.3, false)
4613
    end
4614
    if Grab == true then
4615
      for i = 1, 5 do
4616
        for i = 0, 1, 0.35 do
4617
          swait()
4618
          RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 13, -6), 0.3)
4619
          PlayAnimationFromTable({
4620
            CFrame.new(-0.0701122433, -0.336599797, -0.467321932, 0.694850504, -0.140219957, -0.70535183, 0.704946458, 0.326802045, 0.629484713, 0.142244101, -0.934633017, 0.325926095) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4621
            CFrame.new(-3.05473804E-6, 1.49998987, 8.94069672E-7, 0.707109332, 0.122785509, 0.696362555, 1.49011612E-6, 0.984807491, -0.173649877, -0.707104206, 0.122789055, 0.696367502) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4622
            CFrame.new(1.23286271, 0.549701929, -0.640782475, 0.740093768, 0.612683415, 0.277277708, 0.0735714883, 0.336068332, -0.938959956, -0.668469429, 0.715318501, 0.203645304) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4623
            CFrame.new(-1.63418663, 0.202915072, -0.0286649466, 0.865367413, 0.490698665, 0.101754986, -0.445756227, 0.846484005, -0.291146517, -0.228999093, 0.206590697, 0.951251805) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4624
            CFrame.new(0.702593744, -1.71321297, 0.369734973, 0.965928972, -0.148447216, 0.212003857, 1.10641122E-6, 0.819153726, 0.573574424, -0.258809477, -0.554031372, 0.791244447) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4625
            CFrame.new(-0.577289343, -1.34221494, -0.247686923, 0.766049445, -0.219846189, 0.604016602, 1.58697367E-6, 0.939692199, 0.342021465, -0.642781496, -0.262004316, 0.719851196) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
4626
          }, 0.4, false)
4627
        end
4628
        for i = 0, 1, 0.3 do
4629
          swait()
4630
          RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1, -6), 0.3)
4631
          PlayAnimationFromTable({
4632
            CFrame.new(-0.170705646, -0.774955988, -0.472947001, 0.827218175, 0.130671635, 0.546475112, -0.561879098, 0.194839522, 0.803946257, -0.00142200035, -0.972091854, 0.234596446) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4633
            CFrame.new(-1.76951289E-7, 1.49999058, 2.2649765E-6, 0.80180192, -0.161171481, -0.575445414, 0.176131338, 0.983905077, -0.0301590711, 0.571044207, -0.0771723837, 0.817283988) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4634
            CFrame.new(1.59014189, 0.537312388, -0.263691217, 0.798337102, -0.524361372, 0.296147287, 0.455999702, 0.205153137, -0.866011977, 0.393347621, 0.826412499, 0.402889967) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4635
            CFrame.new(-1.41546631, 0.414666086, 0.337005794, 0.716736436, 0.581529975, 0.384852976, -0.56681174, 0.807305396, -0.164264664, -0.406218559, -0.100404784, 0.908243656) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4636
            CFrame.new(0.793360233, -1.59947133, 0.0620805621, 0.876221955, -0.148448378, -0.458477885, 0.368687749, 0.81915307, 0.439383447, 0.310339272, -0.55403173, 0.772486985) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4637
            CFrame.new(-0.535338402, -1.81867206, 0.817932665, 0.829598367, 0.11430642, -0.546535134, 0.32139504, 0.702652454, 0.634810925, 0.456587166, -0.702291727, 0.546181798) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
4638
          }, 0.7, false)
4639
        end
4640
        local hit, pos = rayCast(HitboxR.Position, CFrame.new(RootPart.Position, RootPart.Position - Vector3.new(0, 1, 0)).lookVector, 100, Character)
4641
        if hit ~= nil then
4642
          MagnitudeDamage(HitboxR, 5, 10, 30, 0, "Normal", "610359515", 1.3)
4643
          Effects.Block.Create(BrickColor.new("Pastel blue-green"), CFrame.new(pos), 1, 1, 1, 0.7, 0.7, 0.7, 0.09, 1)
4644
          Effects.Wave.Create(BrickColor.new("Pastel blue-green"), CFrame.new(pos), 1, 1, 1, 0.7, 0.7, 0.7, 0.09)
4645
          Effects.Sphere.Create(BrickColor.new("Pastel blue-green"), CFrame.new(pos), 3, 3, 3, 5, 5, 5, 0.09)
4646
        end
4647
      end
4648
    end
4649
    for i, v in pairs(RightArm:GetChildren()) do
4650
      if v.Name == "asd" and v:IsA("Weld") then
4651
        v:Remove()
4652
      end
4653
    end
4654
    Grab = false
4655
    con1:disconnect()
4656
    attack = false
4657
  end
4658
  local IsWearingArmor = false
4659
  function Armor(Mode)
4660
    attack = true
4661
    if IsWearingArmor == false and Mode == "On" then
4662
      IsWearingArmor = true
4663
      Disappear()
4664
      swait(10)
4665
      ReappearArmorOnly()
4666
      Character.Humanoid.MaxHealth = 500
4667
      Character.Humanoid.Health = 500
4668
      AHandleRWeld.Part0 = Character["Right Arm"]
4669
      AHandleLWeld.Part0 = Character["Left Arm"]
4670
      for i, v in pairs(AdvancingFortress:GetChildren()) do
4671
        if v:IsA("BasePart") then
4672
          v.Transparency = 1
4673
        end
4674
      end
4675
      for i, v in pairs(Character:GetChildren()) do
4676
        if v:IsA("Accessory") then
4677
          v.Handle.Transparency = 1
4678
        end
4679
      end
4680
    elseif IsWearingArmor == true and Mode == "Off" then
4681
      IsWearingArmor = false
4682
      DisappearArmorOnly()
4683
      for i, v in pairs(Character:GetChildren()) do
4684
        if v:IsA("Accessory") then
4685
          v.Handle.Transparency = 0
4686
        end
4687
      end
4688
      swait(10)
4689
      Reappear()
4690
      Character.Humanoid.MaxHealth = 100
4691
      Character.Humanoid.Health = 100
4692
4693
      AHandleRWeld.Part0 = RightArm
4694
      AHandleLWeld.Part0 = LeftArm
4695
4696
      for i, v in pairs(AdvancingFortress:GetChildren()) do
4697
        if v:IsA("BasePart") then
4698
          v.Transparency = 0
4699
        end
4700
      end
4701
    end
4702
    attack = false
4703
  end
4704
  local ShieldMode = false
4705
  local ShieldCharge = false
4706
  function HoloHexShield()
4707
    attack = true
4708
    Shield.Parent = m
4709
    Shield.CanCollide = true
4710
    if ShieldMode == true then
4711
      while ShieldMode == true do
4712
        swait()
4713
        Effects.Elec.Create(Shield.CFrame, 6, 6, 6)
4714
        RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1.3, -4), 0.3)
4715
        PlayAnimationFromTable({
4716
          CFrame.new(-1.35600567E-6, -0.00759640103, -0.0868249983, 0.499999046, -1.78813579E-7, -0.866026044, 0.150384009, 0.984807789, 0.0868238211, 0.852869093, -0.173648283, 0.492402941) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4717
          CFrame.new(1.49011612E-7, 1.4999963, -2.08616257E-7, 0.499999046, 0.0754797831, 0.862731695, -1.78813579E-7, 0.996196151, -0.0871563852, -0.866026044, 0.0435779616, 0.498097092) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4718
          CFrame.new(1.50238657, 0.320674658, 0.252193451, 0.855209947, -0.376432747, -0.356249839, 0.469514668, 0.853786647, 0.224954769, 0.219480619, -0.35964793, 0.906907678) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4719
          CFrame.new(-0.944740474, 0.689363539, -0.718644142, 0.836517215, -0.545084715, 0.0558781698, -0.258834839, -0.482974619, -0.836504936, 0.482953727, 0.685287297, -0.545103252) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4720
          CFrame.new(0.61525929, -1.85127568, 0.120779425, 0.928754449, -0.162676111, 0.333104134, 0.0394990072, 0.93689239, 0.347407103, -0.368597984, -0.309496939, 0.876555264) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4721
          CFrame.new(-0.849455297, -1.60697818, -0.270956695, 0.696359396, -0.136922374, 0.704511464, -0.122786656, 0.944430828, 0.30491665, -0.707112312, -0.298836082, 0.640850842) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
4722
        }, 0.3, false)
4723
      end
4724
    end
4725
    Shield.CanCollide = false
4726
    CFuncs.Sound.Create("200632211", HitboxR, 1, 0.8)
4727
    CFuncs.Sound.Create("200632875", HitboxR, 1, 0.9)
4728
    Character.HumanoidRootPart.Velocity = Character.HumanoidRootPart.CFrame.lookVector * 160
4729
    Effects.Wave.Create(BrickColor.new("Pastel blue-green"), RootPart.CFrame * CFrame.Angles(math.rad(90), math.rad(0), math.rad(0)), 0.5, 0.5, 0.5, 0.6, 0.6, 0.6, 0.06)
4730
    for i = 0, 1, 0.05 do
4731
      swait()
4732
      MagnitudeDamage(Shield, 5, 10, 15, 20, "Normal", "610359515", 1.3)
4733
      Effects.Elec.Create(Shield.CFrame, 6, 6, 6)
4734
      RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1.3, -3), 1)
4735
      PlayAnimationFromTable({
4736
        CFrame.new(8.64267349E-7, -0.183445007, -0.748600185, 0.499999046, -1.19209105E-7, -0.866026044, 0.496732056, 0.819152176, 0.28678751, 0.709407032, -0.573576331, 0.409575343) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4737
        CFrame.new(-7.15255737E-7, 1.50001967, -6.2584877E-7, 0.499999046, 0.36600244, 0.784893453, -1.19209105E-7, 0.90631634, -0.42262283, -0.866026044, 0.211310923, 0.453157306) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4738
        CFrame.new(1.76569033, 0.610707581, 0.171269983, 0.658267856, -0.680293143, -0.322312057, 0.725086272, 0.457917482, 0.514355659, -0.202320263, -0.572288036, 0.794703186) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4739
        CFrame.new(-1.07552779, 1.01543474, -0.975205183, 0.645357251, -0.653341353, -0.39580214, -0.64124006, -0.181770697, -0.745500326, 0.4151209, 0.734918237, -0.536255598) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4740
        CFrame.new(0.630614281, -1.76328135, 0.440194428, 0.866077662, -0.24334389, 0.436684549, -0.0614839792, 0.815044224, 0.57612747, -0.496114343, -0.525820255, 0.69092983) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4741
        CFrame.new(-0.857700765, -1.25810766, -0.239681423, 0.499215126, -0.257185757, 0.827429712, -0.238765404, 0.877132356, 0.416689515, -0.832931936, -0.405579239, 0.376470625) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
4742
      }, 0.5, false)
4743
    end
4744
    Shield.Parent = nil
4745
    attack = false
4746
  end
4747
  Mouse.Button1Down:connect(function()
4748
    if attack == false and attacktype == 1 then
4749
      attacktype = 2
4750
      attackone()
4751
    elseif attack == false and attacktype == 2 then
4752
      attacktype = 1
4753
      attacktwo()
4754
    end
4755
  end)
4756
  game.Lighting.Outlines = false
4757
  function attackone()
4758
    attack = true
4759
    for i = 0, 1, 0.12 do
4760
      swait()
4761
      RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1.3, -4), 0.3)
4762
      PlayAnimationFromTable({
4763
        CFrame.new(1.51857734E-4, -0.310488015, -0.087417841, 0.707106054, 5.26835073E-8, -0.707107484, 0.122787014, 0.984807968, 0.122786865, 0.696365058, -0.173646957, 0.696363688) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4764
        CFrame.new(0.101928703, 1.50244772, -0.0383823365, 0.76589334, 0.0762532279, 0.638430059, -0.0196644422, 0.995256186, -0.095281601, -0.642666996, 0.0604211651, 0.763759375) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4765
        CFrame.new(1.01774633, 0.557527065, -0.776187301, 0.541353703, 0.741649806, 0.396095604, 0.711713314, -0.153383806, -0.685520053, -0.447661191, 0.653015316, -0.610876858) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4766
        CFrame.new(-1.07208586, 0.264054269, -0.716768324, 0.529938459, -0.260122895, -0.807156265, -0.752277017, 0.295165181, -0.589030504, 0.39146477, 0.919355154, -0.039265126) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4767
        CFrame.new(0.81415844, -1.89738977, 0.144144416, 0.866025925, -0.171008825, 0.469845951, -1.40815973E-6, 0.939692497, 0.342020512, -0.499999285, -0.296199232, 0.813797772) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4768
        CFrame.new(-0.818738878, -1.59999573, -0.397991776, 0.642786622, 0.0667650178, 0.763130188, 4.3399632E-7, 0.99619472, -0.0871558338, -0.766045213, 0.0560229495, 0.640340626) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
4769
      }, 0.3, false)
4770
    end
4771
    MagnitudeDamage(HitboxR, 7, 10, 15, math.random(1, 3), "Normal", "260430079", 1)
4772
    CFuncs.Sound.Create("200632136", HitboxR, 1, 1)
4773
    RootPart.Velocity = RootPart.CFrame.lookVector * 40
4774
    for i = 0, 1, 0.11 do
4775
      swait()
4776
      RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1.3, -4), 0.3)
4777
      PlayAnimationFromTable({
4778
        CFrame.new(0.31380862, -0.320521832, 0.0252371654, 0.249517962, -0.150383011, 0.956622124, -0.0458769947, 0.984923244, 0.166798219, -0.967282891, -0.0855060965, 0.238856897) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4779
        CFrame.new(0.101926193, 1.50244832, -0.0383800864, 0.337979913, 0.0762555003, -0.938059092, -0.0828148723, 0.995255768, 0.051067099, 0.937502801, 0.0604255944, 0.342691481) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4780
        CFrame.new(1.96121001, 0.774859428, -0.462411612, 0.340120375, -0.92077136, 0.191045195, 0.466549307, -0.0111669078, -0.884424806, 0.816486418, 0.389942825, 0.42578721) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4781
        CFrame.new(-1.36170578, 0.526111126, -0.597925961, 0.81348151, -0.212761745, -0.541276693, -0.539894938, 0.0697831511, -0.838834763, 0.216243982, 0.974609077, -0.0581016839) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4782
        CFrame.new(0.970680714, -1.68610644, -0.0975568295, 0.579166114, -0.127570763, -0.805166125, 0.110368893, 0.990856647, -0.0776019096, 0.807703912, -0.0439208932, 0.587950349) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4783
        CFrame.new(-0.827146292, -1.8113209, -0.0556658059, 0.816036701, 0.217413262, -0.535551846, -0.0871567726, 0.962250471, 0.257832885, 0.571391284, -0.163724124, 0.804180741) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
4784
      }, 0.45, false)
4785
    end
4786
    attack = false
4787
  end
4788
  function attacktwo()
4789
    attack = true
4790
    for i = 0, 1, 0.12 do
4791
      swait()
4792
      RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1.3, -4), 0.3)
4793
      PlayAnimationFromTable({
4794
        CFrame.new(-0.0382043272, -0.447743475, -0.209081307, 0.653245032, -0.0733856931, 0.753581822, -0.271655023, 0.906307638, 0.323743671, -0.706735075, -0.416198224, 0.572105408) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4795
        CFrame.new(-2.74181366E-6, 1.49999321, -3.4570694E-6, 0.707105815, -0.183012873, -0.683013678, -8.7171793E-7, 0.965925694, -0.258819759, 0.707107782, 0.183013588, 0.683011472) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4796
        CFrame.new(1.65075588, 0.743636727, -0.356577665, 0.542998552, -0.115416825, 0.831764221, 0.839699984, 0.0834951103, -0.536593378, -0.00751632452, 0.989801884, 0.142253295) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4797
        CFrame.new(-1.08620656, -0.00580590963, -0.864283919, 0.656464815, -0.698875248, 0.283949524, 0.478162557, 0.0943745971, -0.873186052, 0.583450615, 0.708990037, 0.396129608) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4798
        CFrame.new(0.856426239, -1.40340364, -0.356423855, 0.707105279, -0.122788861, -0.696365654, 9.42498446E-7, 0.98480767, -0.173648372, 0.707108438, 0.122787014, 0.696362913) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4799
        CFrame.new(-0.695387185, -1.90375674, -0.304245114, 0.92541647, 0.246137589, -0.288133472, -0.173648298, 0.951251149, 0.254887551, 0.336824656, -0.185843274, 0.923044682) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
4800
      }, 0.34, false)
4801
    end
4802
    MagnitudeDamage(HitboxL, 7, 10, 15, math.random(1, 3), "Normal", "260430079", 1.1)
4803
    CFuncs.Sound.Create("200632136", HitboxL, 1, 1)
4804
    RootPart.Velocity = RootPart.CFrame.lookVector * 40
4805
    for i = 0, 1, 0.12 do
4806
      swait()
4807
      RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1.3, -4), 0.3)
4808
      PlayAnimationFromTable({
4809
        CFrame.new(-0.479634404, -0.393727064, -0.220339894, 0.248309121, 0.219825819, -0.94340837, 0.019257009, 0.972597659, 0.231695861, 0.968489468, -0.0756994039, 0.237271711) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4810
        CFrame.new(-4.01586294E-6, 1.4999907, -1.59628689E-6, 0.237956509, -0.0991817266, 0.966198623, 0.22414881, 0.973527908, 0.0447304621, -0.945057809, 0.205928385, 0.253888786) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4811
        CFrame.new(1.08192515, 0.657660127, -1.1749661, 0.228772208, 0.493058115, 0.839379132, 0.874719322, 0.27430138, -0.399530977, -0.427234828, 0.825622678, -0.368534833) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4812
        CFrame.new(-1.23054802, 1.29996836, -0.754827142, 0.94838953, -0.316170156, 0.0243683457, -0.269034386, -0.84291333, -0.465958893, 0.167862713, 0.43535465, -0.88447094) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4813
        CFrame.new(0.839919031, -1.81287205, 0.0102108568, 0.808574855, -0.267538428, 0.524051666, 0.171010748, 0.95905602, 0.22575888, -0.562994003, -0.0929245204, 0.821220458) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4814
        CFrame.new(-0.846072078, -1.7213496, -0.247524291, 0.693717241, 0.0689389557, 0.716940701, -0.0478171073, 0.997620881, -0.0496601462, -0.718658566, 1.68083934E-4, 0.695363283) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
4815
      }, 0.45, false)
4816
    end
4817
    attack = false
4818
  end
4819
  function findNearestTorso(pos)
4820
    local list = game.Workspace:children()
4821
    local torso
4822
    local dist = 1000
4823
    local temp, human, temp2
4824
    for x = 1, #list do
4825
      temp2 = list[x]
4826
      if temp2.className == "Model" and temp2.Name ~= Character.Name then
4827
        temp = temp2:findFirstChild("Torso")
4828
        human = temp2:findFirstChild("Humanoid")
4829
        if temp ~= nil and human ~= nil and human.Health > 0 and dist > (temp.Position - pos).magnitude then
4830
          local dohit = true
4831
          if dohit == true then
4832
            torso = temp
4833
            dist = (temp.Position - pos).magnitude
4834
          end
4835
        end
4836
      end
4837
    end
4838
    return torso, dist
4839
  end
4840
  function TrueAim(aim)
4841
    local target, distance = findNearestTorso(Mouse.Hit.p)
4842
    local tehcf = HitboxR.CFrame * CFrame.fromEulerAnglesXYZ(1.57, 0, 0).lookVector
4843
    if aim ~= nil then
4844
      tehcf = aim
4845
    end
4846
    table.insert(Effects, {
4847
      tehcf,
4848
      "Shoot",
4849
      30,
4850
      HitboxR.Position,
4851
      10,
4852
      15,
4853
      0,
4854
      3,
4855
      HitboxR,
4856
      target
4857
    })
4858
  end
4859
  function FireProjectiles()
4860
    attack = true
4861
    Humanoid.WalkSpeed = 20
4862
    CFuncs.Sound.Create("300915902", HitboxR, 1, 0.8)
4863
    for i = 0, 1, 0.1 do
4864
      swait()
4865
      Effects.Elec.Create(HitboxR.CFrame, 2, 2, 2)
4866
      PlayAnimationFromTable({
4867
        CFrame.new(0, -0.100000001, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4868
        CFrame.new(0, 1.49999201, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4869
        CFrame.new(0.874554753, 1.14087927, -1.06730831, -0.166365892, 0.198266983, 0.965925813, 0.797995508, -0.548363924, 0.250000268, 0.579245627, 0.812396049, -0.0669871047) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4870
        CFrame.new(-0.257126778, 1.24225974, -0.962940335, 0.692363203, -0.593008757, -0.411064416, -0.708803177, -0.665577948, -0.233675212, -0.135024026, 0.453151852, -0.88114804) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4871
        CFrame.new(0.604643881, -1.9909004, 0.0280392915, 0.962250233, -0.0841861367, -0.258818984, 0.0871560201, 0.996194661, 4.23252061E-7, 0.257834047, -0.0225580372, 0.965925872) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4872
        CFrame.new(-0.604644895, -1.99090064, 0.0280393362, 0.962250233, 0.0841861367, 0.258818984, -0.0871560201, 0.996194661, 4.23252061E-7, -0.257834047, -0.0225580372, 0.965925872) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
4873
      }, 0.3, false)
4874
    end
4875
    for i = 0, 1, 0.1 do
4876
      swait()
4877
      Effects.Elec.Create(HitboxR.CFrame, 3, 3, 3)
4878
      Effects.Block.Create(BrickColor.new("Pastel blue-green"), HitboxR.CFrame, 1, 1, 1, 1, 1, 1, 0.1)
4879
      Effects.Sphere2.Create(BrickColor.new("Pastel blue-green"), HitboxR.CFrame, 1, 1, 1, 1, 1, 1, 0.1)
4880
      PlayAnimationFromTable({
4881
        CFrame.new(0, -0.100000001, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4882
        CFrame.new(0, 1.49999201, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4883
        CFrame.new(0.661153734, 0.568759024, -0.827975571, -0.166752055, 0.025078943, 0.985679924, 0.98324734, -0.0704026297, 0.168131784, 0.0736110285, 0.99720335, -0.012919019) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4884
        CFrame.new(-0.390097797, 0.861622274, -0.554995477, 0.351840883, -0.837056041, -0.418981194, -0.935129642, -0.294365793, -0.197183579, 0.0417199843, 0.461178988, -0.886325777) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4885
        CFrame.new(0.604644954, -1.9909004, 0.0280390829, 0.962250233, -0.0841861367, -0.258818984, 0.0871560201, 0.996194661, 4.23252061E-7, 0.257834047, -0.0225580372, 0.965925872) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4886
        CFrame.new(-0.604644775, -1.99090064, 0.0280380547, 0.962250233, 0.0841861367, 0.258818984, -0.0871560201, 0.996194661, 4.23252061E-7, -0.257834047, -0.0225580372, 0.965925872) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
4887
      }, 0.2, false)
4888
    end
4889
    for i = 1, 10 do
4890
      for i = 0, 1, 0.3 do
4891
        swait()
4892
        Effects.Elec.Create(HitboxR.CFrame, 3, 3, 3)
4893
        Effects.Sphere2.Create(BrickColor.new("Pastel blue-green"), HitboxR.CFrame, 1, 1, 1, 1, 1, 1, 0.1)
4894
        PlayAnimationFromTable({
4895
          CFrame.new(0, -0.100000001, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4896
          CFrame.new(0, 1.49999201, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4897
          CFrame.new(0.661153734, 0.568759024, -0.827975571, -0.166752055, 0.025078943, 0.985679924, 0.98324734, -0.0704026297, 0.168131784, 0.0736110285, 0.99720335, -0.012919019) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4898
          CFrame.new(-0.390097797, 0.861622274, -0.554995477, 0.351840883, -0.837056041, -0.418981194, -0.935129642, -0.294365793, -0.197183579, 0.0417199843, 0.461178988, -0.886325777) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4899
          CFrame.new(0.604644954, -1.9909004, 0.0280390829, 0.962250233, -0.0841861367, -0.258818984, 0.0871560201, 0.996194661, 4.23252061E-7, 0.257834047, -0.0225580372, 0.965925872) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4900
          CFrame.new(-0.604644775, -1.99090064, 0.0280380547, 0.962250233, 0.0841861367, 0.258818984, -0.0871560201, 0.996194661, 4.23252061E-7, -0.257834047, -0.0225580372, 0.965925872) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
4901
        }, 0.3, false)
4902
      end
4903
      CFuncs.Sound.Create("300916105", HitboxR, 1, 1.2)
4904
      CFuncs.Sound.Create("300916014", HitboxR, 1, 1)
4905
      Effects.Sphere2.Create(BrickColor.new("Pastel blue-green"), HitboxR.CFrame, 1, 1, 1, 2, 2, 2, 0.07)
4906
      local MouseLook = CFrame.new((HitboxR.Position + Mouse.Hit.p) / 2, Mouse.Hit.p)
4907
      TrueAim(MouseLook.lookVector)
4908
      for i = 0, 1, 0.3 do
4909
        swait()
4910
        Effects.Elec.Create(HitboxR.CFrame, 3, 3, 3)
4911
        Effects.Sphere2.Create(BrickColor.new("Pastel blue-green"), HitboxR.CFrame, 1, 1, 1, 1, 1, 1, 0.1)
4912
        PlayAnimationFromTable({
4913
          CFrame.new(1.90734863E-6, -0.25291419, 0.238341585, 1, 0, 0, 0, 0.996194661, -0.087155968, 0, 0.087155968, 0.996194661) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4914
          CFrame.new(0, 1.49999189, -1.1920929E-6, 1, 0, 0, 0, 0.98480767, 0.173648626, 0, -0.173648626, 0.98480767) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4915
          CFrame.new(0.689965963, 0.767623663, -0.856841147, -0.544456005, 0.160545677, 0.823281765, 0.798456132, -0.201499581, 0.567332089, 0.256973624, 0.966241658, -0.0184810348) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4916
          CFrame.new(-0.392649293, 0.920519292, -0.977094412, 0.403439909, -0.887421727, -0.222977459, -0.91384387, -0.378501445, -0.147058249, 0.0461054072, 0.263095737, -0.963667512) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4917
          CFrame.new(0.598512471, -1.89166105, 0.0173719227, 0.962250233, -0.061308533, -0.265171409, 0.0871564373, 0.992403805, 0.0868248865, 0.257834017, -0.106658652, 0.960284173) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
4918
          CFrame.new(-0.598512232, -1.89166129, 0.0173728764, 0.962250233, 0.061308533, 0.265171409, -0.0871564373, 0.992403805, 0.0868248865, -0.257834017, -0.106658652, 0.960284173) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
4919
        }, 0.3, false)
4920
      end
4921
    end
4922
    Humanoid.WalkSpeed = 20
4923
    attack = false
4924
  end
4925
SHRA=false
4926
4927
Check=false
4928
dimension=workspace
4929
Mouse.KeyUp:connect(function(k)
4930
	if k=='e' then
4931
		Long=false
4932
	end
4933
end)
4934
reload2=false
4935
hand=true -- collect hands
4936
  Mouse.KeyDown:connect(function(k)
4937
    k = k:lower()
4938
	if k=='r' and dimension==workspace then
4939
	Meg=Instance.new('Part')
4940
	Meg.Parent=Character
4941
	Meg.CFrame=Mouse.Hit
4942
	Meg.Transparency=1
4943
	Meg.CanCollide=false
4944
	Meg.Touched:connect(function(h)
4945
		if h.Parent~=Character or h.Parent~=workspace or h.Parent~=AdvancingFortress then
4946
		if h.Parent:findFirstChild('Torso')~=nil and h.Parent:findFirstChild('Humanoid')~=nil then
4947
			enem=h.Parent
4948
		
4949
			end
4950
		end
4951
	end)
4952
	wait(.1)
4953
	if enem~=nil then
4954
		eclone(enem.Torso)
4955
		
4956
	end
4957
	elseif k=='t' then
4958
	if dimension==workspace then
4959
		dimension=workspace.CurrentCamera
4960
		workspace.CurrentCamera.FieldOfView=180
4961
	elseif dimension==workspace.CurrentCamera then
4962
		dimension=workspace
4963
		workspace.CurrentCamera.FieldOfView=70
4964
	end
4965
	Character.Parent=dimension
4966
	elseif k=='y' then
4967
		if YOURCLONE~=nil then
4968
			Sav=YOURCLONE.Torso.CFrame
4969
			Sav2=YOURCLONE.Humanoid.Health
4970
			YOURCLONE.Torso.CFrame=Character.Torso.CFrame
4971
			Character.Torso.CFrame=Sav
4972
			YOURCLONE.Humanoid.Health=Character.Humanoid.Health
4973
			Character.Humanoid.Health=Sav2
4974
		end
4975
		if YOURCLONE== nil then
4976
		yclone()
4977
		end
4978
	end
4979
	if dimension==workspace then	
4980
	if k=='f' and IsWearingArmor == false and Invisible == false and reload2==false then
4981
		reload2=true
4982
		M=Instance.new('Part',Character)
4983
		M.Shape='Ball'
4984
		M.Material='Glass'
4985
		M.BrickColor=BrickColor.new('Gold')
4986
		M.Transparency=.5
4987
		M.Position=Character.Torso.Position
4988
		M.Size=Vector3.new(10,10,10)
4989
		M.CanCollide=false
4990
		M.Touched:connect(function(h)
4991
		if h.Parent~=Character or h.Parent~=workspace or h.Parent~=AdvancingFortress or h.Parent~=MEF then
4992
			if h:IsA('Part') and h.Anchored==false then
4993
				h.Velocity=Vector3.new(math.random(-70,70),math.random(40,50),math.random(-70,70))
4994
			end	
4995
			end
4996
		end)
4997
		W=Instance.new('Weld',Character)
4998
		W.Part0=M
4999
		W.Part1=Character.Torso
5000
		wait(10)
5001
		M:remove()
5002
		wait(10)
5003
		reload2=false
5004
	end
5005
if k=='e' and IsWearingArmor == false and Invisible == false  then
5006
	Long=true
5007
Lattack()
5008
end
5009
    if attack == false and ora == false and k == "z" and IsWearingArmor == false and Invisible == false  then
5010
      ora = true
5011
      ORA()
5012
    elseif attack == false and k == "x" and IsWearingArmor == false and Invisible == false then
5013
      GRABEMBOIGRABEM()
5014
    elseif attack == false and k=='g' then
5015
--      FireProjectiles()--thats lame
5016
if changeidle==1 then
5017
	changeidle=2 
5018
	else changeidle=1
5019
end
5020
5021
end
5022
	end
5023
5024
    if attack == false and k == "q" and Invisible == false and IsWearingArmor == false then
5025
      Invisible = true
5026
      Effects.Sphere.Create(BrickColor.new("Pastel blue-green"), Torso.CFrame, 1, 1, 1, 4, 4, 4, 0.1)
5027
      Effects.Block.Create(BrickColor.new("Pastel blue-green"), Torso.CFrame, 1, 1, 1, 4, 4, 4, 0.1, 1)
5028
      Disappear()
5029
    elseif attack == false and k == "q" and Invisible == true and IsWearingArmor == false then
5030
      Invisible = false
5031
      Effects.Sphere.Create(BrickColor.new("Pastel blue-green"), Torso.CFrame, 1, 1, 1, 4, 4, 4, 0.08)
5032
5033
      for i = 1, 2 do
5034
        Effects.Block.Create(BrickColor.new("Pastel blue-green"), Torso.CFrame, 1, 1, 1, 4, 4, 4, 0.1, 1)
5035
      end
5036
      for i = 1, 20 do
5037
        Effects.Break.Create(BrickColor.new("Pastel blue-green"), Torso.CFrame, 1, 1, 1)
5038
      end
5039
      Reappear()
5040
      G=Instance.new('Sound',AdvancingFortress.FTorso)
5041
	  G.Name='FLEF'
5042
	  G.SoundId='rbxassetid://1275713993'
5043
	  G.Volume=3
5044
	  G:Play()
5045
    elseif attack == false and ShieldMode == false and k == "c" and IsWearingArmor == false and Invisible == false and dimension==workspace then
5046
      ShieldMode = true
5047
      HoloHexShield()
5048
    elseif attack == false and k == "v" and IsWearingArmor == false and Invisible == false and dimension==workspace then
5049
      CastleCrusherFist()
5050
5051
end
5052
    --[[if k == "[" and IsWearingArmor == false and Invisible == false then
5053
      Armor("On")
5054
    end
5055
    if k == "]" and IsWearingArmor == true and Invisible == false then
5056
      Armor("Off")
5057
    end--]]
5058
  end)
5059
5060
 Mouse.KeyUp:connect(function(k)
5061
    k = k:lower()
5062
    if attack == true and ora == true and k == "z" and IsWearingArmor == false then
5063
      ora = false
5064
    elseif attack == true and ShieldMode == true and k == "c" and IsWearingArmor == false then
5065
      ShieldMode = false
5066
 	end
5067
  end)
5068
--  coroutine.resume(coroutine.create(function(Part, Part2)
5069
--    while Part.Parent ~= nil do
5070
--      swait(math.random(100, 150))
5071
--      for i = 0, 1, 0.2 do
5072
--        wait()
5073
--        Eye1.Mesh.Scale = Vector3.new(1, 0.7 - 1 * i, 1)
5074
--        Eye2.Mesh.Scale = Vector3.new(1, 0.7 - 1 * i, 1)
5075
--      end
5076
--      for i = 0, 1, 0.2 do
5077
--        swait()
5078
--        Eye1.Mesh.Scale = Vector3.new(1, 0.7 + 0.3 * i, 1)
5079
--        Eye2.Mesh.Scale = Vector3.new(1, 0.7 + 0.3 * i, 1)
5080
--      end
5081
--    end
5082
--  end), Eye1, Eye2)
5083
	tfk=CFuncs.Sound.Create(1325068271, Character.Torso, 1.5, 1)
5084
  tfk.Name='THEME'
5085
	tfk.Looped=true
5086
	changeidle=1
5087
	YOURCLONE=nil
5088
	candecide=true
5089
	Humanoid=Character.Humanoid
5090
while true do
5091
5092
5093
for _,v in pairs(AdvancingFortress.FTorso:GetChildren()) do	
5094
	end
5095
    swait()
5096
    for i, v in pairs(Character:children()) do
5097
      if v:IsA("Part") and IsWearingArmor == true then
5098
        v.Anchored = false
5099
      end
5100
    end
5101
    for i, v in pairs(AdvancingFortress:GetChildren()) do
5102
      if v:IsA("Part") then
5103
        v.Material = "SmoothPlastic"
5104
        v.CanCollide = false
5105
      elseif v:IsA("Humanoid") then
5106
        v:remove()
5107
      elseif v:IsA("Accessory") then
5108
        v:remove()
5109
      elseif v:IsA("Shirt") then
5110
        v:remove()
5111
      elseif v:IsA("Pants") then
5112
        v:remove()
5113
      elseif v:IsA("Script") or v:IsA("LocalScript") then
5114
        v:remove()
5115
      elseif v:IsA("BodyColors") then
5116
        v:remove()
5117
      end
5118
    end
5119
    AHandleR.Transparency = 1
5120
    AHandleL.Transparency = 1
5121
    RootPart.Transparency = 1
5122
    HitboxR.Transparency = 1
5123
    HitboxL.Transparency = 1
5124
    Head.BrickColor = BrickColor.new("Pastel blue-green")
5125
    Torso.BrickColor = BrickColor.new("Pastel blue-green")
5126
    RightArm.BrickColor = BrickColor.new("Pastel blue-green")
5127
    LeftArm.BrickColor = BrickColor.new("Pastel blue-green")
5128
    RightLeg.BrickColor = BrickColor.new("Pastel blue-green")
5129
    LeftLeg.BrickColor = BrickColor.new("Pastel blue-green")
5130
    RootPart.Anchored = true
5131
    Torsovelocity = (Character.HumanoidRootPart.Velocity * Vector3.new(1, 0, 1)).magnitude
5132
    velocity = Character.HumanoidRootPart.Velocity.y
5133
    sine = sine + change
5134
    Shield.Anchored = true
5135
    Shield.CFrame = Shield.CFrame:lerp(RootPart.CFrame * CFrame.new(0, 0, -3.2), 1)
5136
    local hit, pos = rayCast(Character.HumanoidRootPart.Position, CFrame.new(Character.HumanoidRootPart.Position, Character.HumanoidRootPart.Position - Vector3.new(0, 1, 0)).lookVector, 4, Character)
5137
    if Character.HumanoidRootPart.Velocity.y > 1 and hit == nil then
5138
      Anim = "Jump"
5139
      if attack == false then
5140
        RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(-2, 1 + 0.5 * math.cos(sine / 20), 3), 0.5)
5141
        PlayAnimationFromTable({
5142
          CFrame.new(0,0,0) * CFrame.new(0, 0, 0) * CFrame.Angles(.5, -1, 0),
5143
          CFrame.new(0,1.5,0) * CFrame.new(0, 0, 0) * CFrame.Angles(1, 1, 0),
5144
          CFrame.new(1.5,0,0) * CFrame.new(-1, 0, -.3) * CFrame.Angles(1.5, 0, -1.5),
5145
          CFrame.new(-1.5,0,0) * CFrame.new(1, 0, -.5) * CFrame.Angles(3, 0, 1),
5146
          CFrame.new(.5,-2,0) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
5147
          CFrame.new(-.5,-2,0) * CFrame.new(0, 0.5, -0.3) * CFrame.Angles(-.5, 0, 0)
5148
		  		}, 0.3, false)
5149
      end
5150
    elseif Character.HumanoidRootPart.Velocity.y < -1 and hit == nil then
5151
      Anim = "Fall"
5152
      if attack == false then
5153
        RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(-2, 1 + 0.5 * math.cos(sine / 20), 3), 0.5)
5154
        PlayAnimationFromTable({
5155
          CFrame.new(0,0,0) * CFrame.new(0, 0, 0) * CFrame.Angles(1, -1, 1),
5156
          CFrame.new(0,1.5,0) * CFrame.new(0, 0, 0) * CFrame.Angles(-1, 1, 0.5),
5157
          CFrame.new(1.5,0,0) * CFrame.new(-1, 0, -.3) * CFrame.Angles(1.5, 0, -1.5),
5158
          CFrame.new(-1.5,0,0) * CFrame.new(1, 0, -.5) * CFrame.Angles(3, 0, 1),
5159
          CFrame.new(.5,-2,0) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
5160
          CFrame.new(-.5,-2,0) * CFrame.new(0, 0.5, -0.3) * CFrame.Angles(-.5, 0, 0)
5161
		  		}, 0.3, false)
5162
      end
5163
    elseif Torsovelocity < 1 and hit ~= nil then
5164
      Anim = "Idle"
5165
	if changeidle==1 then
5166
      if attack == false then
5167
        change = 1
5168
        RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(-2, 1 + 0.5 * math.cos(sine / 20), 3), 0.5)
5169
        PlayAnimationFromTable({
5170
          CFrame.new(0,0,0) * CFrame.new(0, 0, 0) * CFrame.Angles(1, -1, 1),
5171
          CFrame.new(0,1.5,0) * CFrame.new(0, 0, 0) * CFrame.Angles(-1, 1, 0.5),
5172
          CFrame.new(1.5,0,0) * CFrame.new(-1.2, 0, -.3) * CFrame.Angles(1.5, 0, -1.5),
5173
          CFrame.new(-1.5,0,0) * CFrame.new(1.5, 0.3, -.5) * CFrame.Angles(3, 0, 1),
5174
          CFrame.new(.5,-2,0) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
5175
          CFrame.new(-.5,-2,0) * CFrame.new(0, 0.5, -0.3) * CFrame.Angles(-.5, 0, 0)
5176
        }, 0.3, false)
5177
      end
5178
	elseif changeidle==2 then
5179
		        change = 1
5180
		if not attack then
5181
        RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(-2, 1 + 0.5 * math.cos(sine / 20), 3), 0.5)
5182
        PlayAnimationFromTable({
5183
          CFrame.new(0,0,0) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
5184
          CFrame.new(0,1.5,0) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
5185
          CFrame.new(1.5,0,0) * CFrame.new(-1.5, 0.4, -.5) * CFrame.Angles(3, 0, -1),
5186
          CFrame.new(-1.5,0,0) * CFrame.new(1.5, 0.4, -.5) * CFrame.Angles(3, 0, 1),
5187
          CFrame.new(.5,-2,0) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
5188
          CFrame.new(-.5,-2,0) * CFrame.new(0, 0.5, -0.3) * CFrame.Angles(-.5, 0, 0)
5189
        }, 0.3, false)
5190
end
5191
end
5192
    elseif Torsovelocity > 2 and hit ~= nil then
5193
      Anim = "Walk"
5194
      if attack == false then
5195
        RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(-2, 1 + 0.5 * math.cos(sine / 20), 3), 0.5)
5196
        PlayAnimationFromTable({
5197
          CFrame.new(0,0,0) * CFrame.new(0, 0, 0) * CFrame.Angles(-1, -1, 0),
5198
          CFrame.new(0,1.5,0) * CFrame.new(0, 0, 0) * CFrame.Angles(1, 0, 0),
5199
          CFrame.new(1.5,0,0) * CFrame.new(-1, 0, -.3) * CFrame.Angles(1.5, 0, -1.5),
5200
          CFrame.new(-1.5,0,0) * CFrame.new(1, 0, -.5) * CFrame.Angles(3, 0, 1),
5201
          CFrame.new(.5,-2,0) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
5202
          CFrame.new(-.5,-2,0) * CFrame.new(0, 0.5, -0.3) * CFrame.Angles(-.5, 0, 0)
5203
		  		}, 0.3, false)
5204
      end
5205
    end
5206
    if 0 < #Effects then
5207
      for e = 1, #Effects do
5208
        if Effects[e] ~= nil then
5209
          local Thing = Effects[e]
5210
          if Thing ~= nil then
5211
            local Part = Thing[1]
5212
            local Mode = Thing[2]
5213
            local Delay = Thing[3]
5214
            local IncX = Thing[4]
5215
            local IncY = Thing[5]
5216
            local IncZ = Thing[6]
5217
            if Thing[2] == "Shoot" then
5218
              local Look = Thing[1]
5219
              local move = 30
5220
              if Thing[8] == 3 then
5221
                move = 10
5222
              end
5223
              local hit, pos = rayCast(Thing[4], Thing[1], move, m)
5224
              if Thing[10] ~= nil then
5225
                da = pos
5226
                cf2 = CFrame.new(Thing[4], Thing[10].Position)
5227
                cfa = CFrame.new(Thing[4], pos)
5228
                tehCF = cfa:lerp(cf2, 0.2)
5229
                Thing[1] = tehCF.lookVector
5230
              end
5231
              local mag = (Thing[4] - pos).magnitude
5232
              Effects.Head.Create(Torso.BrickColor, CFrame.new((Thing[4] + pos) / 2, pos) * CFrame.Angles(1.57, 0, 0), 1, mag * 5, 1, 0.5, 0, 0.5, 0.2)
5233
              if Thing[8] == 2 then
5234
                Effects.Ring.Create(Torso.BrickColor, CFrame.new((Thing[4] + pos) / 2, pos) * CFrame.Angles(1.57, 0, 0) * CFrame.fromEulerAnglesXYZ(1.57, 0, 0), 1, 1, 0.1, 0.5, 0.5, 0.1, 0.1, 1)
5235
              end
5236
              Thing[4] = Thing[4] + Look * move
5237
              Thing[3] = Thing[3] - 1
5238
              if 2 < Thing[5] then
5239
                Thing[5] = Thing[5] - 0.3
5240
                Thing[6] = Thing[6] - 0.3
5241
              end
5242
              if hit ~= nil then
5243
                Thing[3] = 0
5244
                if Thing[8] == 1 or Thing[8] == 3 then
5245
                  Damage(hit, hit, Thing[5], Thing[6], Thing[7], "Normal", RootPart, 0, "", 1)
5246
                elseif Thing[8] == 2 then
5247
                  Damage(hit, hit, Thing[5], Thing[6], Thing[7], "Normal", RootPart, 0, "", 1)
5248
                  if hit.Parent:findFirstChild("Humanoid") ~= nil or hit.Parent.Parent:findFirstChild("Humanoid") ~= nil then
5249
                    ref = CFuncs.Part.Create(workspace, "Neon", 0, 1, BrickColor.new("Pastel blue-green"), "Reference", Vector3.new())
5250
                    ref.Anchored = true
5251
                    ref.CFrame = CFrame.new(pos)
5252
                    CFuncs.Sound.Create("161006093", ref, 1, 1.2)
5253
                    game:GetService("Debris"):AddItem(ref, 0.2)
5254
                    Effects.Block.Create(Torso.BrickColor, CFrame.new(ref.Position) * CFrame.fromEulerAnglesXYZ(math.random(-50, 50), math.random(-50, 50), math.random(-50, 50)), 1, 1, 1, 10, 10, 10, 0.1, 2)
5255
                    Effects.Ring.Create(BrickColor.new("Bright yellow"), CFrame.new(ref.Position) * CFrame.fromEulerAnglesXYZ(math.random(-50, 50), math.random(-50, 50), math.random(-50, 50)), 1, 1, 0.1, 4, 4, 0.1, 0.1)
5256
                    MagnitudeDamage(ref, 15, Thing[5] / 1.5, Thing[6] / 1.5, 0, "Normal", "", 1)
5257
                  end
5258
                end
5259
                ref = CFuncs.Part.Create(workspace, "Neon", 0, 1, BrickColor.new("Pastel blue-green"), "Reference", Vector3.new())
5260
                ref.Anchored = true
5261
                ref.CFrame = CFrame.new(pos)
5262
                Effects.Sphere.Create(Torso.BrickColor, CFrame.new(pos), 5, 5, 5, 1, 1, 1, 0.07)
5263
                game:GetService("Debris"):AddItem(ref, 1)
5264
              end
5265
              if Thing[3] <= 0 then
5266
                table.remove(Effects, e)
5267
              end
5268
            end
5269
            if Thing[2] == "FireWave" then
5270
              if Thing[3] <= Thing[4] then
5271
                Thing[1].CFrame = Thing[1].CFrame * CFrame.fromEulerAnglesXYZ(0, 1, 0)
5272
                Thing[3] = Thing[3] + 1
5273
                Thing[6].Scale = Thing[6].Scale + Vector3.new(Thing[5], 0, Thing[5])
5274
              else
5275
                Part.Parent = nil
5276
                table.remove(Effects, e)
5277
              end
5278
            end
5279
            if Thing[2] ~= "Shoot" and Thing[2] ~= "Wave" and Thing[2] ~= "FireWave" then
5280
              if Thing[1].Transparency <= 1 then
5281
                if Thing[2] == "Block1" then
5282
                  Thing[1].CFrame = Thing[1].CFrame * CFrame.fromEulerAnglesXYZ(math.random(-50, 50), math.random(-50, 50), math.random(-50, 50))
5283
                  Mesh = Thing[7]
5284
                  Mesh.Scale = Mesh.Scale + Vector3.new(Thing[4], Thing[5], Thing[6])
5285
                  Thing[1].Transparency = Thing[1].Transparency + Thing[3]
5286
                elseif Thing[2] == "Block2" then
5287
                  Thing[1].CFrame = Thing[1].CFrame
5288
                  Mesh = Thing[7]
5289
                  Mesh.Scale = Mesh.Scale + Vector3.new(Thing[4], Thing[5], Thing[6])
5290
                  Thing[1].Transparency = Thing[1].Transparency + Thing[3]
5291
                elseif Thing[2] == "Fire" then
5292
                  Thing[1].CFrame = CFrame.new(Thing[1].Position) + Vector3.new(0, 0.2, 0)
5293
                  Thing[1].CFrame = Thing[1].CFrame * CFrame.fromEulerAnglesXYZ(math.random(-50, 50), math.random(-50, 50), math.random(-50, 50))
5294
                  Thing[1].Transparency = Thing[1].Transparency + Thing[3]
5295
                elseif Thing[2] == "Cylinder" then
5296
                  Mesh = Thing[7]
5297
                  Mesh.Scale = Mesh.Scale + Vector3.new(Thing[4], Thing[5], Thing[6])
5298
                  Thing[1].Transparency = Thing[1].Transparency + Thing[3]
5299
                elseif Thing[2] == "Blood" then
5300
                  Mesh = Thing[7]
5301
                  Thing[1].CFrame = Thing[1].CFrame * CFrame.new(0, 0.5, 0)
5302
                  Mesh.Scale = Mesh.Scale + Vector3.new(Thing[4], Thing[5], Thing[6])
5303
                  Thing[1].Transparency = Thing[1].Transparency + Thing[3]
5304
                elseif Thing[2] == "Elec" then
5305
                  Thing[1].Size = Thing[1].Size + Vector3.new(Thing[7], Thing[8], Thing[9])
5306
                  Thing[1].Transparency = Thing[1].Transparency + Thing[3]
5307
                elseif Thing[2] == "Disappear" then
5308
                  Thing[1].Transparency = Thing[1].Transparency + Thing[3]
5309
                elseif Thing[2] == "Shatter" then
5310
                  Thing[1].Transparency = Thing[1].Transparency + Thing[3]
5311
                  Thing[4] = Thing[4] * CFrame.new(0, Thing[7], 0)
5312
                  Thing[1].CFrame = Thing[4] * CFrame.fromEulerAnglesXYZ(Thing[6], 0, 0)
5313
                  Thing[6] = Thing[6] + Thing[5]
5314
                end
5315
              else
5316
                Part.Parent = nil
5317
                table.remove(Effects, e)
5318
              end
5319
            end
5320
          end
5321
        end
5322
      end
5323
    end
5324
  end