View difference between Paste ID: 1UEppjq1 and TFZYf1ca
SHOW: | | - or go back to the newest paste.
1
--https://github.com/Mokiros/roblox-FE-compatibility
2
if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
3
local Player,game,owner = owner,game
4
local RealPlayer = Player
5
do
6
	print("FE Compatibility code V2 by Mokiros")
7
	local RealPlayer = RealPlayer
8
	script.Parent = RealPlayer.Character
9
10
	--Fake event to make stuff like Mouse.KeyDown work
11
	local Disconnect_Function = function(this)
12
		this[1].Functions[this[2]] = nil
13
	end
14
	local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
15
	local FakeEvent_Metatable = {__index={
16
		Connect = function(this,f)
17
			local i = tostring(math.random(0,10000))
18
			while this.Functions[i] do
19
				i = tostring(math.random(0,10000))
20
			end
21
			this.Functions[i] = f
22
			return setmetatable({this,i},Disconnect_Metatable)
23
		end
24
	}}
25
	FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
26
	local function fakeEvent()
27
		return setmetatable({Functions={}},FakeEvent_Metatable)
28
	end
29
30
	--Creating fake input objects with fake variables
31
    local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
32
    FakeMouse.keyUp = FakeMouse.KeyUp
33
    FakeMouse.keyDown = FakeMouse.KeyDown
34
	local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
35
	local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
36
		CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
37
	end}
38
	--Merged 2 functions into one by checking amount of arguments
39
	CAS.UnbindAction = CAS.BindAction
40
41
	--This function will trigger the events that have been :Connect()'ed
42
	local function TriggerEvent(self,ev,...)
43
		for _,f in pairs(self[ev].Functions) do
44
			f(...)
45
		end
46
	end
47
	FakeMouse.TriggerEvent = TriggerEvent
48
	UIS.TriggerEvent = TriggerEvent
49
50
	--Client communication
51
	local Event = Instance.new("RemoteEvent")
52
	Event.Name = "UserInput_Event"
53
	Event.OnServerEvent:Connect(function(plr,io)
54
	    if plr~=RealPlayer then return end
55
		FakeMouse.Target = io.Target
56
		FakeMouse.Hit = io.Hit
57
		if not io.isMouse then
58
			local b = io.UserInputState == Enum.UserInputState.Begin
59
			if io.UserInputType == Enum.UserInputType.MouseButton1 then
60
				return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
61
			end
62
			if io.UserInputType == Enum.UserInputType.MouseButton2 then
63
				return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
64
			end
65
			for _,t in pairs(CAS.Actions) do
66
				for _,k in pairs(t.Keys) do
67
					if k==io.KeyCode then
68
						t.Function(t.Name,io.UserInputState,io)
69
					end
70
				end
71
			end
72
			FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
73
			UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
74
	    end
75
	end)
76
	Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
77
	local Mouse = owner:GetMouse()
78
	local UIS = game:GetService("UserInputService")
79
	local input = function(io,RobloxHandled)
80
		if RobloxHandled then return end
81
		--Since InputObject is a client-side instance, we create and pass table instead
82
		Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
83
	end
84
	UIS.InputBegan:Connect(input)
85
	UIS.InputEnded:Connect(input)
86
	local h,t
87
	--Give the server mouse data every second frame, but only if the values changed
88
	--If player is not moving their mouse, client won't fire events
89
	local HB = game:GetService("RunService").Heartbeat
90
	while true do
91
		if h~=Mouse.Hit or t~=Mouse.Target then
92
			h,t=Mouse.Hit,Mouse.Target
93
			Event:FireServer({isMouse=true,Target=t,Hit=h})
94
		end
95
		--Wait 2 frames
96
		for i=1,2 do
97
			HB:Wait()
98
		end
99
	end]==],script)
100
101
	----Sandboxed game object that allows the usage of client-side methods and services
102
	--Real game object
103
	local RealGame = game
104
105
	--Metatable for fake service
106
	local FakeService_Metatable = {
107
		__index = function(self,k)
108
			local s = rawget(self,"_RealService")
109
			if s then
110
				return typeof(s[k])=="function"
111
				and function(_,...)return s[k](s,...)end or s[k]
112
			end
113
		end,
114
		__newindex = function(self,k,v)
115
			local s = rawget(self,"_RealService")
116
			if s then s[k]=v end
117
		end
118
	}
119
	local function FakeService(t,RealService)
120
		t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
121
		return setmetatable(t,FakeService_Metatable)
122
	end
123
124
	--Fake game object
125
	local FakeGame = {
126
		GetService = function(self,s)
127
			return rawget(self,s) or RealGame:GetService(s)
128
		end,
129
		Players = FakeService({
130
			LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
131
		},"Players"),
132
		UserInputService = FakeService(UIS,"UserInputService"),
133
		ContextActionService = FakeService(CAS,"ContextActionService"),
134
		RunService = FakeService({
135
			_btrs = {},
136
			RenderStepped = RealGame:GetService("RunService").Heartbeat,
137
			BindToRenderStep = function(self,name,_,fun)
138
				self._btrs[name] = self.Heartbeat:Connect(fun)
139
			end,
140
			UnbindFromRenderStep = function(self,name)
141
				self._btrs[name]:Disconnect()
142
			end,
143
		},"RunService")
144
	}
145
	rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
146
	FakeGame.service = FakeGame.GetService
147
	FakeService(FakeGame,game)
148
	--Changing owner to fake player object to support owner:GetMouse()
149
	game,owner = FakeGame,FakeGame.Players.LocalPlayer
150
end
151
152
  wait(1)--this was so much work i did not change the animations from the last stand sorry...
153
warn "Slenercat5's"
154
warn "Dirty Deeds Done Dirt Cheep"
155
warn "Q to call stand"
156
warn "E to do far range attack"
157
warn "R to make Enemy clone"
158
warn "T to jump to other dimension"
159
warn "Y to Make Clone"
160
warn "F to use love train"
161
warn "moveset based on project jojo's d4c"
162
warn "Model by JojofMer"
163
warn"sorry currently 1 color"
164
warn "Avatar clothing and hair by Masterofroblox1206"
165
plr = game.Players.LocalPlayer
166
mse = plr:GetMouse()
167
sound = Instance.new("Sound", game.Workspace)
168
sound.SoundId = "https://www.roblox.com/asset/?id=274698941"
169
sound.Volume = 10
170
canworld = true
171
BeeSpeed = 50
172
173
chr=plr.Character
174
tors=torso
175
--[[
176
for _,v in pairs(plr.Character:GetChildren())do
177
if v:IsA('Shirt') or v:IsA('Pants') or v:IsA('Accessory') then
178
	v:remove()
179
end
180
end
181
local sh = Instance.new("Shirt",chr)
182
sh.ShirtTemplate = "http://www.roblox.com/asset/?id=394790364"
183
p=Instance.new('Pants',chr)
184
p.PantsTemplate='http://www.roblox.com/asset/?id=394795102'--]]
185
186
chr['Left Arm'].BrickColor=BrickColor.new('Pastel brown')
187
chr['Right Arm'].BrickColor=BrickColor.new('Pastel brown')
188
chr['Torso'].BrickColor=BrickColor.new('Pastel brown')
189
chr.Head.BrickColor=BrickColor.new('Pastel brown')
190
191
192
193
194
local Players=game:service'Players'
195
local Player=Players.LocalPlayer
196
local Mouse=Player:GetMouse''
197
Character=Player.Character
198
199
local RenderStepped=game:service'RunService'.RenderStepped
200
201
local MeshId='http://www.roblox.com/asset?id=779592805'
202
local TextureId='http://www.roblox.com/asset/?id=775493027'
203
204
205
local QHold=false
206
local EHold=false
207
208
cut = Instance.new("Sound", chr)
209
cut.SoundId = "https://www.roblox.com/asset/?id=0"
210
cut.Volume = 1.5
211
thri = Instance.new("Sound", chr)
212
thri.SoundId = "https://www.roblox.com/asset/?id=186311262"
213
thri.Volume = 2.5
214
215
216
Sound2=Instance.new('Sound')
217
Sound2.SoundId='rbxassetid://616594063'
218
Sound2.Parent=Player.Character.Head
219
220
221
  Effects = {}
222
  local Player = game.Players.localPlayer
223
  local Character = Player.Character
224
  Character.Archivable = true
225
  AdvancingFortress = Character:Clone()
226
--[[
227
Hair=Instance.new('Part',Character)
228
Hair.Size=Vector3.new(1,1,1)
229
M=Instance.new('FileMesh',Hair)
230
M.Scale=Vector3.new(.028,.028,.028)
231
M.MeshId='rbxassetid://1450916371'
232
M.TextureId='rbxassetid://1450916523'
233
WARF=Instance.new('Weld',Hair)
234
WARF.Part0=Hair
235
WARF.Part1=Character.Head
236
WARF.C0=CFrame.new(0,-.2,0)--]]
237
238
239
--//D4cCostume
240
241
function eclone(targetPart)
242
	
243
--Converted with ttyyuu12345's model to script plugin v4
244
function sandbox(var,func)
245
	local env = getfenv(func)
246
	local newenv = setmetatable({},{
247
		__index = function(self,k)
248
			if k=="script" then
249
				return var
250
			else
251
				return env[k]
252
			end
253
		end,
254
	})
255
	setfenv(func,newenv)
256
	return func
257
end
258
cors = {}
259
mas = Instance.new("Model",game:GetService("Lighting"))
260
Model0 = Instance.new("Model")
261
Part1 = Instance.new("Part")
262
SpecialMesh2 = Instance.new("SpecialMesh")
263
Decal3 = Instance.new("Decal")
264
Part4 = Instance.new("Part")
265
Decal5 = Instance.new("Decal")
266
Motor6 = Instance.new("Motor")
267
Motor7 = Instance.new("Motor")
268
Motor8 = Instance.new("Motor")
269
Motor9 = Instance.new("Motor")
270
Motor10 = Instance.new("Motor")
271
Part11 = Instance.new("Part")
272
Part12 = Instance.new("Part")
273
Part13 = Instance.new("Part")
274
Part14 = Instance.new("Part")
275
Humanoid15 = Instance.new("Humanoid")
276
Humanoid15.WalkToPart=targetPart
277
BodyColors16 = Instance.new("BodyColors")
278
Script17 = Instance.new("Script")
279
Model0.Name = "Clone"
280
Model0.Parent = mas
281
Model0.PrimaryPart = Part1
282
Part1.Name = "Head"
283
Part1.Parent = Model0
284
Part1.BrickColor = BrickColor.new("Bright yellow")
285
Part1.FormFactor = Enum.FormFactor.Symmetric
286
Part1.Size = Vector3.new(2, 1, 1)
287
Part1.CFrame = CFrame.new(6.34995413, 4.50001717, 23.1599998, 1, 0, 0, 0, 1, 0, 0, 0, 1)
288
Part1.TopSurface = Enum.SurfaceType.Smooth
289
Part1.Color = Color3.new(0.960784, 0.803922, 0.188235)
290
Part1.Position = Vector3.new(6.34995413, 4.50001717, 23.1599998)
291
Part1.Color = Color3.new(0.960784, 0.803922, 0.188235)
292
SpecialMesh2.Parent = Part1
293
SpecialMesh2.Scale = Vector3.new(1.25, 1.25, 1.25)
294
SpecialMesh2.Scale = Vector3.new(1.25, 1.25, 1.25)
295
Decal3.Name = "face"
296
Decal3.Parent = Part1
297
Decal3.Texture = "rbxasset://textures/face.png"
298
Part4.Name = "Torso"
299
Part4.Parent = Model0
300
Part4.BrickColor = BrickColor.new("Bright blue")
301
Part4.FormFactor = Enum.FormFactor.Symmetric
302
Part4.Size = Vector3.new(2, 2, 1)
303
Part4.CFrame = CFrame.new(6.34995413, 3.00001717, 23.1599998, 1, 0, 0, 0, 1, 0, 0, 0, 1)
304
Part4.LeftSurface = Enum.SurfaceType.Weld
305
Part4.RightSurface = Enum.SurfaceType.Weld
306
Part4.Color = Color3.new(0.0509804, 0.411765, 0.67451)
307
Part4.Position = Vector3.new(6.34995413, 3.00001717, 23.1599998)
308
Part4.Color = Color3.new(0.0509804, 0.411765, 0.67451)
309
Decal5.Name = "roblox"
310
Decal5.Parent = Part4
311
Motor6.Name = "Right Shoulder"
312
Motor6.Parent = Part4
313
Motor6.C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
314
Motor6.C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
315
Motor6.Part0 = Part4
316
Motor6.Part1 = Part12
317
Motor6.MaxVelocity = 0.15000000596046
318
Motor7.Name = "Left Shoulder"
319
Motor7.Parent = Part4
320
Motor7.C0 = CFrame.new(-1, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
321
Motor7.C1 = CFrame.new(0.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
322
Motor7.Part0 = Part4
323
Motor7.Part1 = Part11
324
Motor7.MaxVelocity = 0.15000000596046
325
Motor8.Name = "Right Hip"
326
Motor8.Parent = Part4
327
Motor8.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
328
Motor8.C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
329
Motor8.Part0 = Part4
330
Motor8.Part1 = Part14
331
Motor8.MaxVelocity = 0.10000000149012
332
Motor9.Name = "Left Hip"
333
Motor9.Parent = Part4
334
Motor9.C0 = CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
335
Motor9.C1 = CFrame.new(-0.5, 1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
336
Motor9.Part0 = Part4
337
Motor9.Part1 = Part13
338
Motor9.MaxVelocity = 0.10000000149012
339
Motor10.Name = "Neck"
340
Motor10.Parent = Part4
341
Motor10.C0 = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
342
Motor10.C1 = CFrame.new(0, -0.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
343
Motor10.Part0 = Part4
344
Motor10.Part1 = Part1
345
Motor10.MaxVelocity = 0.10000000149012
346
Part11.Name = "Left Arm"
347
Part11.Parent = Model0
348
Part11.BrickColor = BrickColor.new("Bright yellow")
349
Part11.CanCollide = false
350
Part11.FormFactor = Enum.FormFactor.Symmetric
351
Part11.Size = Vector3.new(1, 2, 1)
352
Part11.CFrame = CFrame.new(4.84995413, 3.00001717, 23.1599998, 1, 0, 0, 0, 1, 0, 0, 0, 1)
353
Part11.Color = Color3.new(0.960784, 0.803922, 0.188235)
354
Part11.Position = Vector3.new(4.84995413, 3.00001717, 23.1599998)
355
Part11.Color = Color3.new(0.960784, 0.803922, 0.188235)
356
Part12.Name = "Right Arm"
357
Part12.Parent = Model0
358
Part12.BrickColor = BrickColor.new("Bright yellow")
359
Part12.CanCollide = false
360
Part12.FormFactor = Enum.FormFactor.Symmetric
361
Part12.Size = Vector3.new(1, 2, 1)
362
Part12.CFrame = CFrame.new(7.84995413, 3.00001717, 23.1599998, 1, 0, 0, 0, 1, 0, 0, 0, 1)
363
Part12.Color = Color3.new(0.960784, 0.803922, 0.188235)
364
Part12.Position = Vector3.new(7.84995413, 3.00001717, 23.1599998)
365
Part12.Color = Color3.new(0.960784, 0.803922, 0.188235)
366
Part13.Name = "Left Leg"
367
Part13.Parent = Model0
368
Part13.BrickColor = BrickColor.new("Br. yellowish green")
369
Part13.CanCollide = false
370
Part13.FormFactor = Enum.FormFactor.Symmetric
371
Part13.Size = Vector3.new(1, 2, 1)
372
Part13.CFrame = CFrame.new(5.84995413, 1.00001717, 23.1599998, 1, 0, 0, 0, 1, 0, 0, 0, 1)
373
Part13.BottomSurface = Enum.SurfaceType.Smooth
374
Part13.TopSurface = Enum.SurfaceType.Inlet
375
Part13.Color = Color3.new(0.643137, 0.741176, 0.278431)
376
Part13.Position = Vector3.new(5.84995413, 1.00001717, 23.1599998)
377
Part13.Color = Color3.new(0.643137, 0.741176, 0.278431)
378
Part14.Name = "Right Leg"
379
Part14.Parent = Model0
380
Part14.BrickColor = BrickColor.new("Br. yellowish green")
381
Part14.CanCollide = false
382
Part14.FormFactor = Enum.FormFactor.Symmetric
383
Part14.Size = Vector3.new(1, 2, 1)
384
Part14.CFrame = CFrame.new(6.84995413, 1.00001717, 23.1599998, 1, 0, 0, 0, 1, 0, 0, 0, 1)
385
Part14.BottomSurface = Enum.SurfaceType.Smooth
386
Part14.TopSurface = Enum.SurfaceType.Inlet
387
Part14.Color = Color3.new(0.643137, 0.741176, 0.278431)
388
Part14.Position = Vector3.new(6.84995413, 1.00001717, 23.1599998)
389
Part14.Color = Color3.new(0.643137, 0.741176, 0.278431)
390
Humanoid15.Parent = Model0
391
Humanoid15.NameOcclusion = Enum.NameOcclusion.NoOcclusion
392
Humanoid15.RightLeg = Part14
393
Humanoid15.LeftLeg = Part13
394
Humanoid15.Torso = Part4
395
Humanoid15.WalkToPoint=Vector3.new(0,20,0)
396
BodyColors16.Parent = Model0
397
BodyColors16.HeadColor = BrickColor.new("Bright yellow")
398
BodyColors16.LeftArmColor = BrickColor.new("Bright yellow")
399
BodyColors16.LeftLegColor = BrickColor.new("Br. yellowish green")
400
BodyColors16.RightArmColor = BrickColor.new("Bright yellow")
401
BodyColors16.RightLegColor = BrickColor.new("Br. yellowish green")
402
BodyColors16.TorsoColor = BrickColor.new("Bright blue")
403
Script17.Name = "Full Animation"
404
Script17.Parent = Model0
405
table.insert(cors,sandbox(Script17,function()
406
--[[Made by Jammer622 @[http://www.roblox.com/Advanced-Player-AI-item?id=59391730],
407
This is the ORIGINAL model, if you see others, they are stolen.
408
Scripts mixed from vanilla Animate, Health, and Sound,
409
with much custom content by myself, making them great AIs.
410
No help from Miked's scripts, I made my own joint script.
411
If you find any glitches, bugs, or just want to suggest an idea, please message me.
412
My team works hard on these AIs, please don't make attempts to steal them.
413
Your feedback is extremely appreciated!
414
415
	_---=CREDITS=---_
416
The Roblox Team		Without them, none of this would be possible.
417
	Vanilla Sound
418
	Vanilla Health
419
	Vanilla Animate
420
Jammer622				That's me, main programmer and weapon publisher.
421
	Main Developer
422
	Health GUI Script
423
	Animation Work
424
	Relationship Work
425
	Wandering
426
	Pathing (Map Generation)
427
	Weapon Usage
428
	Weapon (Re)Publishing
429
		Sonypony458
430
			McDonalds Drink
431
	Customization
432
	Teamwork AI
433
	Model Variables
434
	Setting Wiki [Below]
435
Macdeath					I owe it to him for keeping me on track during this.
436
	Feature Inspiration
437
	Problem Solving
438
	Suggestions
439
lah30303					Amazing pathing work goes to this fine sir.
440
	Pathing (Pathing Generation/System)
441
442
	_---=SETTINGS=---_
443
Inside this model's file, you'll find several values that can be changed.
444
	DropWeapon					-This sets whether or not the bot will drop any equipped weapon upon dying.
445
	Force_Pants					-This must be set through Spawners.
446
	Force_Shirt					-This must be set through Spawners.
447
	Force_Weapon				-This must be set through Spawners.
448
	Force_Hat					-This must be set through Spawners.
449
	IgnoreCombatFF				-This sets whether or not the bot will allow friendly fire during combat.
450
	IsAPlayer					-This is a tag to specify this bot's existance to other AIs.
451
	IsOnTeam						-This sets whether or not the bot is on a team.
452
		ShowTag					-This sets whether or not the bot's team color name shows up beside its own.
453
		Team						-This sets the bot's team color.
454
	PathTo						-This is an experimental pathfinding engine. Use at your own risk!
455
	PrintMap						-This prints maps generated when using PathTo. Use at your own risk!
456
	Respawn						-This sets whether the bot will respawn or not upon death.
457
	Custom_Name					-This must be set through Spawners.
458
	Wander						-This sets whether the bot is stationary or if it moves, but not if it uses weapons or not.
459
]]
460
print("Player Bot Loading")
461
Delay(0, function() --Vanilla Sound
462
	function waitForChild(parent, childName)
463
		local child = parent:findFirstChild(childName)
464
		if child then return child end
465
		while true do
466
			child = parent.ChildAdded:wait()
467
			if child.Name==childName then return child end
468
		end
469
	end
470
	function newSound(id)
471
		local sound = Instance.new("Sound")
472
		sound.SoundId = id
473
		sound.archivable = false
474
		sound.Parent = script.Parent.Head
475
		return sound
476
	end
477
	local sDied = newSound("rbxasset://sounds/uuhhh.wav")
478
	local sFallingDown = newSound("rbxasset://sounds/splat.wav")
479
	local sFreeFalling = newSound("rbxasset://sounds/swoosh.wav")
480
	local sGettingUp = newSound("rbxasset://sounds/hit.wav")
481
	local sJumping = newSound("rbxasset://sounds/button.wav")
482
	local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3")
483
	sRunning.Looped = true
484
	local Figure = script.Parent
485
	local Head = waitForChild(Figure, "Head")
486
	local Humanoid = waitForChild(Figure, "Humanoid")
487
	function onDied()
488
		sDied:Play()
489
	end
490
	function onState(state, sound)
491
		if state then
492
			sound:Play()
493
		else
494
			sound:Pause()
495
		end
496
	end
497
	function onRunning(speed)
498
		if speed>0 then
499
			sRunning:Play()
500
		else
501
			sRunning:Pause()
502
		end
503
	end
504
	
505
	Humanoid.Died:connect(onDied)
506
	Humanoid.Running:connect(onRunning)
507
	Humanoid.Jumping:connect(function(state) onState(state, sJumping) end)
508
	Humanoid.GettingUp:connect(function(state) onState(state, sGettingUp) end)
509
	Humanoid.FreeFalling:connect(function(state) onState(state, sFreeFalling) end)
510
	Humanoid.FallingDown:connect(function(state) onState(state, sFallingDown) end)
511
end)
512
Delay(0, function() --Vanilla Health
513
	function waitForChild(parent, childName)
514
		local child = parent:findFirstChild(childName)
515
		if child then return child end
516
		while true do
517
			child = parent.ChildAdded:wait()
518
			if child.Name==childName then return child end
519
		end
520
	end
521
	local Figure = script.Parent
522
	local Humanoid = waitForChild(Figure, "Humanoid")
523
	local regening = false
524
	function regenHealth()
525
		if regening then return end
526
		regening = true
527
		while Humanoid.Health < Humanoid.MaxHealth do
528
			local s = wait(1)
529
			local health = Humanoid.Health
530
			if health > 0 and health < Humanoid.MaxHealth then
531
				local newHealthDelta = 0.01 * s * Humanoid.MaxHealth
532
				health = health + newHealthDelta
533
				Humanoid.Health = math.min(health,Humanoid.MaxHealth)
534
			end
535
		end
536
		if Humanoid.Health > Humanoid.MaxHealth then
537
			Humanoid.Health = Humanoid.MaxHealth
538
		end
539
		regening = false
540
	end
541
	Humanoid.HealthChanged:connect(regenHealth)
542
end)
543
Delay(0, function() --Vanilla Animate, Multiple Additions
544
	function waitForChild(parent, childName)
545
		local child = parent:findFirstChild(childName)
546
		if child then return child end
547
		while true do
548
			child = parent.ChildAdded:wait()
549
			if child.Name==childName then return child end
550
		end
551
	end
552
	local Figure = script.Parent
553
	local Clone = Figure:Clone()
554
	local Torso = waitForChild(Figure, "Torso")
555
	local Joints = Torso:GetChildren()
556
	for All = 1, #Joints do
557
		if Joints.className == "Motor" or Joints.className == "Motor6D" then
558
			Joints[All]:Remove()
559
		end
560
	end
561
	local RightShoulder = Instance.new("Motor")
562
	local LeftShoulder = Instance.new("Motor")
563
	local RightHip = Instance.new("Motor")
564
	local LeftHip = Instance.new("Motor")
565
	local Neck = Instance.new("Motor")
566
	local Humanoid = waitForChild(Figure, "Humanoid")
567
	ZStat = 1
568
	ZStat2 = 0
569
	local pose = "Standing"
570
	RightShoulder.Part0 = Torso
571
	RightShoulder.Part1 = Figure["Right Arm"]
572
	RightShoulder.MaxVelocity = 0.15
573
	RightShoulder.Name = "Right Shoulder"
574
	RightShoulder.C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
575
	RightShoulder.C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
576
	RightShoulder.Parent = Torso
577
	LeftShoulder.Part0 = Torso
578
	LeftShoulder.Part1 = Figure["Left Arm"]
579
	LeftShoulder.MaxVelocity = 0.15
580
	LeftShoulder.Name = "Left Shoulder"
581
	LeftShoulder.C0 = CFrame.new(-1, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
582
	LeftShoulder.C1 = CFrame.new(0.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
583
	LeftShoulder.Parent = Torso
584
	RightHip.Part0 = Torso
585
	RightHip.Part1 = Figure["Right Leg"]
586
	RightHip.MaxVelocity = 0.1
587
	RightHip.Name = "Right Hip"
588
	RightHip.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
589
	RightHip.C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
590
	RightHip.Parent = Torso
591
	LeftHip.Part0 = Torso
592
	LeftHip.Part1 = Figure["Left Leg"]
593
	LeftHip.MaxVelocity = 0.1
594
	LeftHip.Name = "Left Hip"
595
	LeftHip.C0 = CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
596
	LeftHip.C1 = CFrame.new(-0.5, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
597
	LeftHip.Parent = Torso
598
	Neck.Part0 = Torso
599
	Neck.Part1 = Figure["Head"]
600
	Neck.MaxVelocity = 0.1
601
	Neck.Name = "Neck"
602
	Neck.C0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
603
	Neck.C1 = CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
604
	Neck.Parent = Torso
605
	local toolAnim = "None"
606
	local toolAnimTime = 0
607
	SpawnModel = Instance.new("Model")
608
	function onRunning(speed)
609
		if speed>0 then
610
			pose = "Running"
611
		else
612
			pose = "Standing"
613
		end
614
	end
615
	function CheckTag(Tag)
616
		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
617
			if Tag.Value.Character:FindFirstChild("IsLocalEnemy") == nil then
618
				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
619
					local Tag2 = Instance.new("CFrameValue", Tag.Value.Character)
620
					Tag2.Name = "IsLocalEnemy"
621
					print(Tag.Value.Character.Name .." Has Become An Outlaw")
622
				end
623
			end
624
			if Tag.Value.Character:FindFirstChild("Loc" ..script.Parent.Name) ~= nil then
625
				Tag.Value.Character:FindFirstChild("Loc" ..script.Parent.Name):Remove()
626
			end
627
			local Found = Instance.new("CFrameValue", Tag.Value.Character)
628
			Found.Name = "Loc" ..script.Parent.Name
629
			game:GetService("Debris"):AddItem(Found, 3)
630
		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
631
			if game.Players[Tag.Value].Character:FindFirstChild("IsLocalEnemy") == nil then
632
				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
633
					local Tag2 = Instance.new("CFrameValue", game.Players[Tag.Value].Character)
634
					Tag2.Name = "IsLocalEnemy"
635
					print(Tag.Value .." Has Become An Outlaw")
636
				end
637
			end
638
			if game.Players[Tag.Value].Character:FindFirstChild("Loc" ..script.Parent.Name) ~= nil then
639
				game.Players[Tag.Value].Character:FindFirstChild("Loc" ..script.Parent.Name):Remove()
640
			end
641
			local Found = Instance.new("CFrameValue", game.Players[Tag.Value].Character)
642
			Found.Name = "Loc" ..script.Parent.Name
643
			game:GetService("Debris"):AddItem(Found, 3)
644
		elseif script.Parent:FindFirstChild("IsLocalEnemy") == nil and script.Parent:FindFirstChild("IsAZombie") == nil and Tag.ClassName == "StringValue" and game.Workspace:FindFirstChild(Tag.Value) ~= nil then
645
			if game.Workspace[Tag.Value]:FindFirstChild("IsLocalEnemy") == nil then
646
				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
647
					local Tag2 = Instance.new("CFrameValue", game.Workspace[Tag.Value])
648
					Tag2.Name = "IsLocalEnemy"
649
					print(Tag.Value .." Has Become An Outlaw")
650
				end
651
			end
652
			if game.Workspace[Tag.Value]:FindFirstChild("Loc" ..script.Parent.Name) ~= nil then
653
				game.Workspace[Tag.Value]:FindFirstChild("Loc" ..script.Parent.Name):Remove()
654
			end
655
			local Found = Instance.new("CFrameValue", game.Workspace[Tag.Value])
656
			Found.Name = "Loc" ..script.Parent.Name
657
			game:GetService("Debris"):AddItem(Found, 3)
658
		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
659
			local Found = Instance.new("CFrameValue", Tag.Value.Character)
660
			Found.Name = "Loc" ..script.Parent.Name
661
			game:GetService("Debris"):AddItem(Found, 3)
662
		elseif (script.Parent:FindFirstChild("IsLocalEnemy") ~= nil or script.Parent:FindFirstChild("IsAZombie") ~= nil) and Tag.ClassName == "StringValue" and game.Workspace:FindFirstChild(Tag.Value) ~= nil then
663
			local Found = Instance.new("CFrameValue", game.Workspace[Tag.Value])
664
			Found.Name = "Loc" ..script.Parent.Name
665
			game:GetService("Debris"):AddItem(Found, 3)
666
		end
667
	end
668
	function CheckSpawns(Object)
669
		local Parts = Object:GetChildren()
670
		for Check = 1, #Parts do
671
			if Parts[Check].className == "SpawnLocation" then
672
				local I = Instance.new("Vector3Value", SpawnModel)
673
				I.Value = Parts[Check].Position
674
			end
675
			CheckSpawns(Parts[Check])
676
		end
677
	end
678
	function onDied()
679
		pose = "Dead"
680
		Delay(5, function()
681
			if script.Parent.Respawn.Value == true then
682
				CheckSpawns(Workspace)
683
				local Spawn = SpawnModel:GetChildren()
684
				Clone.Parent = game.Workspace
685
				if #Spawn > 0 then
686
					Spawn = Spawn[math.random(1, #Spawn)].Value
687
					Clone:MoveTo(Spawn)
688
				else
689
					Clone:MoveTo(Vector3.new(0, 50, 0))
690
				end
691
			end
692
			Figure:Remove()
693
			return
694
		end)
695
	end
696
	function onJumping()
697
		pose = "Jumping"
698
	end
699
	function onClimbing()
700
		pose = "Climbing"
701
	end
702
	function onGettingUp()
703
		pose = "GettingUp"
704
	end
705
	function onFreeFall()
706
		pose = "FreeFall"
707
	end
708
	function onFallingDown()
709
		pose = "FallingDown"
710
	end
711
	function onSeated()
712
		pose = "Seated"
713
	end
714
	function onPlatformStanding()
715
		pose = "PlatformStanding"
716
	end
717
	function moveJump()
718
		RightShoulder.MaxVelocity = 0.5
719
		LeftShoulder.MaxVelocity = 0.5
720
		RightShoulder.DesiredAngle = (3.14/ZStat)
721
		LeftShoulder.DesiredAngle = (-3.14/ZStat)
722
		RightHip.DesiredAngle = (0)
723
		LeftHip.DesiredAngle = (0)
724
	end
725
	function moveFreeFall()
726
		RightShoulder.MaxVelocity = 0.5
727
		LeftShoulder.MaxVelocity = 0.5
728
		RightShoulder.DesiredAngle = (3.14/ZStat)
729
		LeftShoulder.DesiredAngle = (-3.14/ZStat)
730
		RightHip.DesiredAngle = (0)
731
		LeftHip.DesiredAngle = (0)
732
	end
733
	function moveSit()
734
		RightShoulder.MaxVelocity = 0.15
735
		LeftShoulder.MaxVelocity = 0.15
736
		RightShoulder.DesiredAngle = (3.14 /2)
737
		LeftShoulder.DesiredAngle = (-3.14 /2)
738
		RightHip.DesiredAngle = (3.14 /2)
739
		LeftHip.DesiredAngle = (-3.14 /2)
740
	end
741
	function getTool()	
742
		for _, kid in ipairs(Figure:GetChildren()) do
743
			if kid.className == "Tool" then return kid end
744
		end
745
		return nil
746
	end
747
	function getToolAnim(tool)
748
		for _, c in ipairs(tool:GetChildren()) do
749
			if c.Name == "toolanim" and c.className == "StringValue" then
750
				return c
751
			end
752
		end
753
		return nil
754
	end
755
	function animateTool()
756
		if (toolAnim == "None") then
757
			RightShoulder.DesiredAngle = (1.57)
758
			return
759
		end
760
		if (toolAnim == "Slash") then
761
			RightShoulder.MaxVelocity = 0.5
762
			RightShoulder.DesiredAngle = (0)
763
			return
764
		end
765
		if (toolAnim == "Lunge") then
766
			RightShoulder.MaxVelocity = 0.5
767
			LeftShoulder.MaxVelocity = 0.5
768
			RightHip.MaxVelocity = 0.5
769
			LeftHip.MaxVelocity = 0.5
770
			RightShoulder.DesiredAngle = (1.57)
771
			LeftShoulder.DesiredAngle = (1.0)
772
			RightHip.DesiredAngle = (1.57)
773
			LeftHip.DesiredAngle = (1.0)
774
			return
775
		end
776
	end
777
	function move(time)
778
		local amplitude
779
		local frequency
780
		if (pose == "Jumping") then
781
			moveJump()
782
			return
783
		end
784
		if (pose == "FreeFall") then
785
			moveFreeFall()
786
			return
787
		end	 
788
		if (pose == "Seated") then
789
			moveSit()
790
			return
791
		end
792
		local climbFudge = 0
793
		if (pose == "Running") then
794
			RightShoulder.MaxVelocity = 0.15
795
			LeftShoulder.MaxVelocity = 0.15
796
			amplitude = 1
797
			frequency = 9
798
		elseif (pose == "Climbing") then
799
			RightShoulder.MaxVelocity = 0.5 
800
			LeftShoulder.MaxVelocity = 0.5
801
			amplitude = 1
802
			frequency = 9
803
			climbFudge = 3.14
804
		else
805
			amplitude = 0.1
806
			frequency = 1
807
		end
808
		desiredAngle = amplitude * math.sin(time*frequency)
809
		RightShoulder.DesiredAngle = (desiredAngle + climbFudge) + ZStat2
810
		LeftShoulder.DesiredAngle = (desiredAngle - climbFudge) -ZStat2
811
		RightHip.DesiredAngle = (-desiredAngle)
812
		LeftHip.DesiredAngle = (-desiredAngle)
813
		local tool = getTool()
814
		if tool then
815
			animStringValueObject = getToolAnim(tool)
816
			if animStringValueObject then
817
				toolAnim = animStringValueObject.Value
818
				animStringValueObject.Parent = nil
819
				toolAnimTime = time + .3
820
			end
821
			if time > toolAnimTime then
822
				toolAnimTime = 0
823
				toolAnim = "None"
824
			end
825
			animateTool()
826
		else
827
			toolAnim = "None"
828
			toolAnimTime = 0
829
		end
830
	end
831
	Humanoid.Died:connect(onDied)
832
	Humanoid.Running:connect(onRunning)
833
	Humanoid.Jumping:connect(onJumping)
834
	Humanoid.Climbing:connect(onClimbing)
835
	Humanoid.GettingUp:connect(onGettingUp)
836
	Humanoid.FreeFalling:connect(onFreeFall)
837
	Humanoid.FallingDown:connect(onFallingDown)
838
	Humanoid.Seated:connect(onSeated)
839
	Humanoid.PlatformStanding:connect(onPlatformStanding)
840
	Humanoid.ChildAdded:connect(CheckTag)
841
	OriginalTime = 0.1
842
	Time = OriginalTime
843
	while Figure.Parent~=nil do
844
		Time = Time + 0.1
845
		wait(OriginalTime)
846
		move(Time)
847
	end
848
end)
849
Delay(0, function() --lah30303's Pathing Script
850
	function CalcMoves(map, px, py, tx, ty) 
851
		if map[ty][tx] ~= 0 then
852
			return nil
853
		end
854
		local openlist, closedlist, listk, closedk, tempH, tempG, xsize, ysize, curbase = {}, {}, 1, 0, math.abs(px - tx) + math.abs(py - ty), 0, #map[1], #map, {}
855
		openlist[1] = {x = px, y = py, g = 0, h = tempH, f = 0 + tempH ,par = 1}
856
		local nodenumber = 0
857
		while listk > 0 do
858
			nodenumber = nodenumber + 1
859
			if nodenumber / ScanSkip == math.floor(nodenumber / ScanSkip) then
860
				wait()
861
				if DebugPathing == true then
862
					print("Node", nodenumber)
863
				end
864
			end
865
			closedk = closedk + 1
866
			table.insert(closedlist, closedk, openlist[1])
867
			curbase = closedlist[closedk]
868
			if closedlist[closedk].x == tx and closedlist[closedk].y == ty then
869
				return closedlist
870
			end
871
			openlist[1] = openlist[listk]
872
			table.remove(openlist, listk)
873
			listk = listk - 1
874
			local v = 1
875
			while true do
876
				local u = v
877
				if 2 * u + 1 <= listk then
878
					if openlist[u].f >= openlist[2 * u].f then
879
						v = 2 * u
880
					end
881
					if openlist[v].f >= openlist[2 * u + 1].f then
882
						v = 2 * u + 1
883
					end
884
				elseif 2 * u <= listk then
885
					if openlist[u].f >= openlist[2 * u].f then
886
						v = 2 * u
887
					end
888
				end
889
				if u ~= v then
890
					local temp = openlist[u]
891
					openlist[u] = openlist[v]
892
					openlist[v] = temp
893
				else
894
					break
895
				end
896
			end
897
898
			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
899
			if closedk > 0 then
900
				for k = 1, closedk do
901
					for i, v in pairs(tocheck) do
902
						if closedlist[k].x == curbase.x + v[1] and closedlist[k].y == curbase.y + v[2] then
903
							tocheck[i] = nil
904
						end
905
					end
906
				end
907
			end
908
			for i, v in pairs(tocheck) do
909
				local a = curbase.x + v[1]
910
				local b = curbase.y + v[2]
911
				if a > xsize or a < 1 or b > ysize or b < 1 then
912
					tocheck[i] = nil
913
				end
914
			end
915
			for i, v in pairs(tocheck) do
916
				local a, b = curbase.x + v[1], curbase.y + v[2]
917
				if a <= xsize and a >= 1 and b <= ysize and b >= 1 and map[b][a] ~= 0 then
918
					tocheck[i] = nil
919
				end
920
			end
921
			tempG = curbase.g + 1
922
			tempDiagG = curbase.g + 1.4
923
			for k = 1, listk do
924
				for i, v in pairs(tocheck) do
925
					if openlist[k].x == curbase.x + v[1] and openlist[k].y == curbase.y + 1 and openlist[k].g > tempG then
926
						tempH = math.abs((curbase.x + v[1])-tx) + math.abs((curbase.y + v[1])-ty)
927
						table.insert(openlist, k, {x = curbase.x + v[1], y = curbase.y + v[2], g = tempG, h = tempH, f = tempG + tempH, par = closedk})
928
						local m = k
929
						while m ~= 1 do
930
							if openlist[m].f <= openlist[math.floor(m/2)].f then
931
								temp = openlist[math.floor(m/2)]
932
								openlist[math.floor(m/2)] = openlist[m]
933
								openlist[m] = temp
934
								m = math.floor(m/2)
935
							else
936
								break
937
							end
938
							tocheck[i] = nil
939
						end
940
					end
941
				end
942
			end
943
			for i, v in pairs(tocheck) do
944
				listk = listk + 1
945
				tempH = math.abs((curbase.x + v[1]) - tx) + math.abs((curbase.y + v[2]) - ty)
946
				table.insert(openlist, listk, {x = curbase.x + v[1], y = curbase.y + v[2], g = tempG, h = tempH, f = tempG+tempH, par = closedk})
947
				m = listk
948
				while m ~= 1 do
949
					if openlist[m].f <= openlist[math.floor(m/2)].f then
950
						temp = openlist[math.floor(m/2)]
951
						openlist[math.floor(m/2)] = openlist[m]
952
						openlist[m] = temp
953
						m = math.floor(m/2)
954
					else
955
						break
956
					end
957
				end
958
			end
959
		end
960
		return nil
961
	end
962
963
964
	function CalcPath(closedlist)
965
966
		if closedlist == nil or table.getn(closedlist) == 1 then
967
			return nil
968
		end
969
		local path = {}
970
		local pathIndex = {}
971
		local last = table.getn(closedlist)
972
		table.insert(pathIndex,1,last)
973
974
		local i = 1
975
		while pathIndex[i] > 1 do
976
			i = i + 1
977
			table.insert(pathIndex, i, closedlist[pathIndex[i - 1]].par)
978
		end 
979
980
		for n = table.getn(pathIndex) - 1, 1, -1 do
981
			table.insert(path, {x = closedlist[pathIndex[n]].x, y = closedlist[pathIndex[n]].y})
982
		end
983
984
		closedlist = nil
985
		return path
986
	end
987
end)
988
Delay(0, function() --Main Artificial Intelligence Scripting/Path Grid Generator
989
	local Base
990
	if script.Parent:FindFirstChild("BASE") == nil then
991
		Base = Instance.new("Part")
992
		Base.Transparency = 1
993
		Base.TopSurface = "Smooth"
994
		Base.BottomSurface = "Smooth"
995
		Base.CanCollide = false
996
		Base.Anchored = true
997
		Base.Locked = true
998
		Base.BrickColor = BrickColor.new(0, 0, 0)
999
		Base.Name = "BASE"
1000
		Base.CFrame = CFrame.new(Vector3.new(0, 0, 0))
1001
		Base.Parent = script.Parent
1002
	else
1003
		Base = script.Parent.BASE
1004
		Base.CFrame = CFrame.new(Vector3.new(0, 0, 0))
1005
	end
1006
	function Jump()
1007
		script.Parent.Humanoid.Jump = true
1008
	end
1009
	function Check(Hit)
1010
		if Hit ~= nil and Hit.Parent ~= nil and Hit.Parent.Parent ~= nil then
1011
			if Hit.Parent:FindFirstChild("Humanoid") == nil and Hit.Parent.Parent:FindFirstChild("Humanoid") == nil then
1012
				Jump()
1013
			end
1014
		end
1015
	end
1016
	script.Parent.Torso.Touched:connect(Check)
1017
	function Prep(Target, Current, Attempts)
1018
		if Attempts == nil then
1019
			Attempts = 1000
1020
		end
1021
		local Hit = false
1022
		local Tag = Base:Clone()
1023
		Tag.Position = Target
1024
		Tag.Parent = script.Parent
1025
		local TagRay = Ray.new(Tag.CFrame.p, (CFrame.new(Tag.CFrame.p - Vector3.new(0, 3, 0)).p - Tag.CFrame.p).Unit * 40)
1026
		local TRHit, TRPos = game.Workspace:FindPartOnRay(TagRay, script.Parent)
1027
		if TRHit ~= nil then
1028
			Hit = true
1029
		end
1030
		if Tag.Parent ~= nil then
1031
			Tag:Remove()
1032
		end
1033
		if Hit == false and Attempts > 0 and script.Parent.Wander.Value == true then
1034
			Prep(script.Parent.Torso.Position + Vector3.new(math.random(-100, 100), 0, math.random(-100, 100)), Base, Attempts - 1)
1035
		elseif script.Parent.Wander.Value == true then
1036
			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))
1037
			local THit, TPos = game.Workspace:FindPartOnRay(TargetRay, script.Parent)
1038
			local TrueTarget = script.Parent.Torso.Position
1039
			if THit ~= nil then
1040
				for HazardCheck = 1, math.floor((script.Parent.Torso.CFrame.p - TPos).Magnitude) do
1041
					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)
1042
					local TH2, TP2 = game.Workspace:FindPartOnRay(TR2, script.Parent)
1043
					if TH2 ~= nil and TH2.Name ~= "Lava" then
1044
						TrueTarget = TP2
1045
					else
1046
						break
1047
					end
1048
				end
1049
			else
1050
				for HazardCheck = 1, math.floor((script.Parent.Torso.CFrame.p - Target).Magnitude) do
1051
					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)
1052
					local TH2, TP2 = game.Workspace:FindPartOnRay(TR2, script.Parent)
1053
					if TH2 ~= nil and TH2.Name ~= "Lava" then
1054
						TrueTarget = TP2
1055
					else
1056
						break
1057
					end
1058
				end
1059
			end
1060
			script.Parent.Humanoid:MoveTo(TrueTarget, Current)
1061
		end
1062
	end
1063
	function ZHit(Part)
1064
		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
1065
			Part.Parent.Humanoid:TakeDamage(2)
1066
			script.Parent.Humanoid.MaxHealth = script.Parent.Humanoid.MaxHealth + 1
1067
			script.Parent.Humanoid:TakeDamage(-1)
1068
		end
1069
	end
1070
	script.Parent["Right Arm"].Touched:connect(ZHit)
1071
	script.Parent["Left Arm"].Touched:connect(ZHit)
1072
	CurrentMap = {}
1073
	MapMask = {}
1074
	MapVar = {0, 0, 0, 0, 0}
1075
	BlockScanned = 0
1076
	ScanSkip = 5
1077
	DebugPathing = true
1078
	function GenerateMap(PathPos)
1079
		CurrentMap = {}
1080
		MapMask = {}
1081
		MapVar = {0, 0, 0, 0, 0}
1082
		BlockScanned = 0
1083
		MapVariables = ScanParts(Workspace, 1)
1084
		for MapX = 1, math.max(-MapVariables[1], MapVariables[2]) * 2 + 1 do
1085
			CurrentMap[MapX] = {}
1086
			for MapY = 1, math.max(-MapVariables[3], MapVariables[4]) * 2 + 1 do
1087
				CurrentMap[MapX][MapY] = 0
1088
			end
1089
		end
1090
		for MaskX = 1, #CurrentMap do
1091
			MapMask[MaskX] = {}
1092
			for MaskY = 1, #CurrentMap[MaskX] do
1093
				MapMask[MaskX][MaskY] = {MapVariables[1] + MaskX - 0.5, MapVariables[1] + MaskY - 0.5}
1094
			end
1095
		end
1096
		ScanParts(Workspace, 2, MapVariables)
1097
		wait(1)
1098
		if script.Parent.PrintMap.Value == true then
1099
			print("Printing Map...")
1100
			for ClearPrint = 1, 250 do
1101
				wait()
1102
				print()
1103
			end
1104
			for PrintX = 1, #CurrentMap do
1105
				local PrintZ = ""
1106
				for PrintY = 1, #CurrentMap[PrintX] do
1107
					PrintZ = PrintZ ..CurrentMap[PrintX][PrintY]
1108
				end
1109
				print(PrintZ)
1110
				wait(0.1)
1111
			end
1112
		end
1113
		local MapCoords = {0, 0, 0, 0}
1114
		local Distance = math.huge
1115
		for MPX = 1, #CurrentMap do
1116
			for MPY = 1, #CurrentMap[MPX] do
1117
				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
1118
					MapCoords = {MPX, MPY, 0, 0}
1119
					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
1120
				end
1121
			end
1122
		end
1123
		local Distance = math.huge
1124
		for MPX = 1, #CurrentMap do
1125
			for MPY = 1, #CurrentMap[MPX] do
1126
				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
1127
					MapCoords = {MapCoords[1], MapCoords[2], math.min(MPX, #CurrentMap) - 1, math.min(MPY, #CurrentMap[1] - 1)}
1128
					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
1129
				end
1130
			end
1131
		end
1132
		for i, v in pairs(CalcPath(CalcMoves(CurrentMap, MapCoords[1], MapCoords[2], MapCoords[3], MapCoords[4]))) do
1133
			local Timer = 20
1134
			local pX = v["x"]
1135
			local pY = v["y"]
1136
			local pTo = Vector3.new(MapMask[pX][pY][1], 0, MapMask[pX][pY][2])
1137
			pTo = pTo + (pTo - Vector3.new(script.Parent.Torso.Position.X, 0, script.Parent.Torso.Position.Z)).Unit
1138
			while (Vector3.new(script.Parent.Torso.Position.X, 0, script.Parent.Torso.Position.Z) - pTo).Magnitude > 2.5 and Timer > 0 do
1139
				script.Parent.Humanoid:MoveTo(pTo, Base)
1140
				Timer = Timer - 1
1141
				if Timer == 10 then
1142
					script.Parent.Humanoid.Jump = true
1143
				end
1144
				wait(0.1)
1145
			end
1146
			if Timer == 0 then
1147
				if (Vector3.new(script.Parent.Torso.Position.X, 0, script.Parent.Torso.Position.Z) - pTo).Magnitude <= 5 then
1148
					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
1149
				else
1150
					break
1151
				end
1152
			end
1153
		end
1154
	end
1155
	function ScanParts(CurrentModel, CurrentStage, Variables)
1156
		local X = CurrentModel:GetChildren()
1157
		for I = 1, #X do
1158
			if #X[I]:GetChildren() > 0 then
1159
				ScanParts(X[I], 1, Variables)
1160
			end
1161
			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
1162
				BlockScanned = BlockScanned + 1
1163
				if BlockScanned / ScanSkip == math.floor(BlockScanned / ScanSkip) then
1164
					wait()
1165
					if DebugPathing == true then
1166
						print("Block", BlockScanned)
1167
					end
1168
				end
1169
				if CurrentStage == 1 then
1170
					MapVar[1] = math.min(math.ceil(X[I].Position.X - X[I].Size.X / 2), MapVar[1])
1171
					MapVar[2] = math.max(math.floor(X[I].Position.X + X[I].Size.X / 2), MapVar[2])
1172
					MapVar[3] = math.min(math.ceil(X[I].Position.Z - X[I].Size.Z / 2), MapVar[3])
1173
					MapVar[4] = math.max(math.floor(X[I].Position.Z + X[I].Size.Z / 2), MapVar[4])
1174
				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
1175
					local BlockStart = {X[I].Position.X - X[I].Size.X / 2, X[I].Position.Z - X[I].Size.Z / 2}
1176
					local BlockEnd = {X[I].Position.X + X[I].Size.X / 2, X[I].Position.Z + X[I].Size.Z / 2}
1177
					local BlockCoords = {0, 0, 0, 0}
1178
					local Distance = math.huge
1179
					for MPX = 1, #CurrentMap do
1180
						for MPY = 1, #CurrentMap[MPX] do
1181
							if (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(BlockStart[1], 0, BlockStart[2])).Magnitude < Distance then
1182
								BlockCoords = {MPX, MPY, 0, 0}
1183
								Distance = (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(BlockStart[1], 0, BlockStart[2])).Magnitude
1184
							end
1185
						end
1186
					end
1187
					local Distance = math.huge
1188
					for MPX = 1, #CurrentMap do
1189
						for MPY = 1, #CurrentMap[MPX] do
1190
							if (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(BlockEnd[1], 0, BlockEnd[2])).Magnitude < Distance then
1191
								BlockCoords = {BlockCoords[1], BlockCoords[2], MPX, MPY}
1192
								Distance = (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(BlockEnd[1], 0, BlockEnd[2])).Magnitude
1193
							end
1194
						end
1195
					end
1196
					for XGrid = BlockCoords[2], BlockCoords[4] do
1197
						for YGrid = BlockCoords[1], BlockCoords[3] do
1198
							CurrentMap[XGrid][YGrid] = 1
1199
						end
1200
					end
1201
				end
1202
			end
1203
		end
1204
		if CurrentStage == 1 then
1205
			MapVar[5] = {MapVar[1] + MapVar[2] / 2, MapVar[3] + MapVar[4] / 2}
1206
			return MapVar
1207
		end
1208
	end
1209
	IsInCombat = false
1210
	while script.Parent.Humanoid.Health > 0 and script.Parent:FindFirstChild("IsAZombie") == nil do
1211
		local Distance = 100
1212
		local Target = nil
1213
		IsInCombat = false
1214
		local Players = Workspace:GetChildren()
1215
		for Check = 1, #Players do
1216
			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
1217
				local Ray = Ray.new(script.Parent.Torso.CFrame.p, (Players[Check].Torso.CFrame.p - script.Parent.Torso.CFrame.p).Unit * 100)
1218
				local Hit, Position = game.Workspace:FindPartOnRay(Ray, script.Parent)
1219
				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
1220
					local TeamTag = nil
1221
					local Parts = Players[Check]:GetChildren()
1222
					for X = 1, #Parts do
1223
						if Parts[X].Name == "TeamLoc" then
1224
							if Parts[X].Value == script.Parent.IsOnTeam.Team.Value then
1225
								TeamTag = Parts[X]
1226
							end
1227
						end
1228
					end
1229
					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
1230
						if script.Parent.IsOnTeam.Value == false then
1231
							if Players[Check]:FindFirstChild("Loc" ..script.Parent.Name) ~= nil then
1232
								Players[Check]:FindFirstChild("Loc" ..script.Parent.Name):Remove()
1233
							end
1234
							local Found = Instance.new("CFrameValue", Players[Check])
1235
							Found.Name = "Loc" ..script.Parent.Name
1236
							game:GetService("Debris"):AddItem(Found, 3)
1237
						else
1238
							if Parts[X] ~= nil then
1239
								Parts[X]:Remove()
1240
							end
1241
							local Found = Instance.new("BrickColorValue", Players[Check])
1242
							Found.Name = "TeamLoc"
1243
							Found.Value = script.Parent.IsOnTeam.Team.Value
1244
							game:GetService("Debris"):AddItem(Found, 3)
1245
							if Players[Check]:FindFirstChild("Loc" ..script.Parent.Name) ~= nil then
1246
								Players[Check]:FindFirstChild("Loc" ..script.Parent.Name):Remove()
1247
							end
1248
							local Found = Instance.new("CFrameValue", Players[Check])
1249
							Found.Name = "Loc" ..script.Parent.Name
1250
							game:GetService("Debris"):AddItem(Found, 3)
1251
						end
1252
					end
1253
					if Players[Check]:FindFirstChild("Loc" ..script.Parent.Name) ~= nil and (Players[Check].Torso.Position - script.Parent.Torso.Position).Magnitude <= Distance then
1254
						Target = Players[Check].Torso
1255
						Distance = (Target.Position - script.Parent.Torso.Position).Magnitude
1256
					end
1257
				end
1258
			end
1259
		end
1260
		if Target == nil then
1261
			local HasTool = false
1262
			local ToolCheck = script.Parent:GetChildren()
1263
			for Check = 1, #ToolCheck do
1264
				if ToolCheck[Check].ClassName == "Tool" then
1265
					HasTool = true
1266
				end
1267
			end
1268
			if HasTool == false then
1269
				Distance = 100
1270
				for Check = 1, #Players do
1271
					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
1272
						local Ray = Ray.new(script.Parent.Torso.CFrame.p, (Players[Check].Handle.CFrame.p - script.Parent.Torso.CFrame.p).Unit * 100)
1273
						local Hit, Position = game.Workspace:FindPartOnRay(Ray, script.Parent)
1274
						if Hit ~= nil and Hit.Parent ~= nil and Hit.Parent == Players[Check] then
1275
							Distance = (Players[Check].Handle.Position - script.Parent.Torso.Position).Magnitude
1276
							Target = Players[Check]
1277
						end
1278
					end
1279
				end
1280
				if Target ~= nil and Target.ClassName == "Tool" then
1281
					if Distance <= 5 and HasTool == false then
1282
						Target.Parent = script.Parent
1283
						HasTool = true
1284
					else
1285
						Prep(Target.Handle.Position, Base)
1286
					end
1287
				else
1288
					for Check = 1, #Players do
1289
						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
1290
							local Ray = Ray.new(script.Parent.Torso.CFrame.p, (Players[Check].CFrame.p - script.Parent.Torso.CFrame.p).Unit * 100)
1291
							local Hit, Position = game.Workspace:FindPartOnRay(Ray, script.Parent)
1292
							if Hit ~= nil and Hit == Players[Check] then
1293
								Target = Players[Check]
1294
								Distance = (Target.Position - script.Parent.Torso.Position).Magnitude
1295
							end
1296
						end
1297
					end
1298
					if Target ~= nil then
1299
						script.Parent.Humanoid:MoveTo(Target.Position, Target)
1300
						if (Target.Position - script.Parent.Torso.Position).Magnitude <= 10 then
1301
							Target.OpenCrate.Value = true
1302
						end
1303
					else
1304
						local HasHat = false
1305
						local HatCheck = script.Parent:GetChildren()
1306
						for Check = 1, #HatCheck do
1307
							if ToolCheck[Check].ClassName == "Hat" then
1308
								HasHat = true
1309
							end
1310
						end
1311
						if HasHat == false then
1312
							Distance = 100
1313
							for Check = 1, #Players do
1314
								if Players[Check].ClassName == "Hat" and Players[Check]:FindFirstChild("Handle") ~= nil and (Players[Check].Handle.Position - script.Parent.Torso.Position).Magnitude <= Distance then
1315
									local Ray = Ray.new(script.Parent.Torso.CFrame.p, (Players[Check].Handle.CFrame.p - script.Parent.Torso.CFrame.p).Unit * 100)
1316
									local Hit, Position = game.Workspace:FindPartOnRay(Ray, script.Parent)
1317
									if Hit ~= nil and Hit.Parent ~= nil and Hit.Parent == Players[Check] then
1318
										Distance = (Players[Check].Handle.Position - script.Parent.Torso.Position).Magnitude
1319
										Target = Players[Check]
1320
									end
1321
								end
1322
							end
1323
							if Target ~= nil and Target.ClassName == "Hat" then
1324
								if Distance <= 5 and HasHat == false then
1325
									Target.Parent = script.Parent
1326
									HasHat = true
1327
								else
1328
									Prep(Target.Handle.Position, Base)
1329
								end
1330
							else
1331
								if script.Parent.Humanoid.PlatformStand == false and script.Parent.Humanoid.Sit == false then
1332
									if script.Parent.PathTo.Value ~= Vector3.new(0, 0, 0) then
1333
										GenerateMap(script.Parent.PathTo.Value)
1334
										script.Parent.PathTo.Value = Vector3.new(0, 0, 0)
1335
									elseif math.random(1, 10) == 1 and script.Parent.Wander.Value == true then
1336
										Prep(script.Parent.Torso.Position + Vector3.new(math.random(-100, 100), 0, math.random(-100, 100)), Base)
1337
									end
1338
								else
1339
									Jump()
1340
								end
1341
							end
1342
						end
1343
					end
1344
				end
1345
			else
1346
				if Target == nil then
1347
					local Distance = 80
1348
					local Players = Workspace:GetChildren()
1349
					for Check = 1, #Players do
1350
						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
1351
							local Ray = Ray.new(script.Parent.Torso.CFrame.p, (Players[Check].Torso.CFrame.p - script.Parent.Torso.CFrame.p).Unit * 100)
1352
							local Hit, Position = game.Workspace:FindPartOnRay(Ray, script.Parent)
1353
							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
1354
								Target = Players[Check].Torso
1355
								Distance = (Target.Position - script.Parent.Torso.Position).Magnitude
1356
							end
1357
						end
1358
					end
1359
					if Target ~= nil then
1360
						local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 10
1361
						Prep(Position, Base)
1362
					else
1363
						if script.Parent.Humanoid.PlatformStand == false and script.Parent.Humanoid.Sit == false then
1364
							if script.Parent.PathTo.Value ~= Vector3.new(0, 0, 0) then
1365
								GenerateMap(script.Parent.PathTo.Value)
1366
								script.Parent.PathTo.Value = Vector3.new(0, 0, 0)
1367
							elseif math.random(1, 10) == 1 and script.Parent.Wander.Value == true then
1368
								Prep(script.Parent.Torso.Position + Vector3.new(math.random(-100, 100), 0, math.random(-100, 100)), Base)
1369
							end
1370
						else
1371
							Jump()
1372
						end
1373
					end
1374
				else
1375
					if script.Parent.Humanoid.PlatformStand == false and script.Parent.Humanoid.Sit == false then
1376
						if script.Parent.PathTo.Value ~= Vector3.new(0, 0, 0) then
1377
							GenerateMap(script.Parent.PathTo.Value)
1378
							script.Parent.PathTo.Value = Vector3.new(0, 0, 0)
1379
						elseif math.random(1, 10) == 1 and script.Parent.Wander.Value == true then
1380
							Prep(script.Parent.Torso.Position + Vector3.new(math.random(-100, 100), 0, math.random(-100, 100)), Base)
1381
						end
1382
					else
1383
						Jump()
1384
					end
1385
				end
1386
			end
1387
		else
1388
			local Weapon = nil
1389
			local ToolCheck = script.Parent:GetChildren()
1390
			for Check = 1, #ToolCheck do
1391
				if ToolCheck[Check].ClassName == "Tool" then
1392
					Weapon = ToolCheck[Check]
1393
				end
1394
			end
1395
			if Weapon ~= nil and Weapon:FindFirstChild("Active") ~= nil and Weapon:FindFirstChild("TargetPos") ~= nil and Weapon:FindFirstChild("Type") ~= nil then
1396
				if Weapon.Type.Value == "Melee" then
1397
					Prep(Target.Position + Vector3.new(math.random(-3, 3), 0, math.random(-3, 3)), Target)
1398
					if (Target.Position - script.Parent.Torso.Position).Magnitude <= 10 then
1399
						Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
1400
						Weapon.Active.Value = true
1401
					end
1402
				elseif Weapon.Type.Value == "Melee/Ranged" then
1403
					if Distance <= 10 then
1404
						Prep(Target.Position + Vector3.new(math.random(-3, 3), 0, math.random(-3, 3)), Target)
1405
						Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
1406
						Weapon.Active.Value = true
1407
					else
1408
						Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 40, Base)
1409
						if (Target.Position - script.Parent.Torso.Position).Magnitude <= 50 then
1410
							Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
1411
							Weapon.Active.Value = true
1412
						end
1413
					end
1414
				elseif Weapon.Type.Value == "Melee/RangedMed" then
1415
					if Distance <= 10 then
1416
						Prep(Target.Position + Vector3.new(math.random(-3, 3), 0, math.random(-3, 3)), Target)
1417
						Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
1418
						Weapon.Active.Value = true
1419
					else
1420
						Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 30, Base)
1421
						if (Target.Position - script.Parent.Torso.Position).Magnitude <= 40 then
1422
							Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
1423
							Weapon.Active.Value = true
1424
						end
1425
					end
1426
				elseif Weapon.Type.Value == "Melee/RangedClose" then
1427
					if Distance <= 10 then
1428
						Prep(Target.Position + Vector3.new(math.random(-3, 3), 0, math.random(-3, 3)), Target)
1429
						Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
1430
						Weapon.Active.Value = true
1431
					else
1432
						Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 20, Base)
1433
						if (Target.Position - script.Parent.Torso.Position).Magnitude <= 30 then
1434
							Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
1435
							Weapon.Active.Value = true
1436
						end
1437
					end
1438
				elseif Weapon.Type.Value == "Ranged" then
1439
					Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 80, Base)
1440
					Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
1441
					wait()
1442
					Weapon.Active.Value = true
1443
				elseif Weapon.Type.Value == "RangedMed" then
1444
					Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 60, Base)
1445
					if Distance <= 70 then
1446
						Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
1447
						wait()
1448
						Weapon.Active.Value = true
1449
					end
1450
				elseif Weapon.Type.Value == "RangedClose" then
1451
					Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 30, Base)
1452
					if Distance <= 40 then
1453
						Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
1454
						wait()
1455
						Weapon.Active.Value = true
1456
					end
1457
				elseif Weapon.Type.Value == "RangedAngle" and Distance <= 100 then
1458
					local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * (script.Parent.Torso.Position - Target.Position).Magnitude + Target.Velocity
1459
					script.Parent.Humanoid:MoveTo(Position, Base)
1460
					Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
1461
					wait()
1462
					Weapon.Active.Value = true
1463
				elseif Weapon.Type.Value == "RangedTactical" then
1464
					if Distance <= 30 then
1465
						local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 50
1466
						Prep(Position, Base)
1467
					elseif Distance >= 50 then
1468
						Prep(Target.Position, Target)
1469
					end
1470
					if Distance <= 50 and Distance >= 30 then
1471
						Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 40, Target.Parent.Torso)
1472
					end
1473
					if Distance <= 60 then
1474
						Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
1475
						wait()
1476
						Weapon.Active.Value = true
1477
					end
1478
				elseif Weapon.Type.Value == "Shuriken" then
1479
					if Distance <= 15 then
1480
						local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 20
1481
						Prep(Position, Base)
1482
					elseif Distance >= 30 then
1483
						Prep(Target.Position, Target)
1484
					end
1485
					if Distance <= 30 and Distance >= 15 then
1486
						Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 20, Target.Parent.Torso)
1487
					end
1488
					if Distance <= 50 then
1489
						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))
1490
						wait()
1491
						Weapon.Active.Value = true
1492
					end
1493
				elseif Weapon.Type.Value == "HealDrink" then
1494
					local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 120
1495
					Prep(Position, Base)
1496
					if script.Parent.Humanoid.Health < script.Parent.Humanoid.MaxHealth then
1497
						Weapon.Active.Value = true
1498
					end
1499
				elseif Weapon.Type.Value == "GrenadeDirect" then
1500
					if Distance >= 80 and Distance <= 100 then
1501
						Prep(Target.Position, Target)
1502
						wait(0.5)
1503
						Weapon.Active.Value = true
1504
						wait(0.5)
1505
						local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 100
1506
						Prep(Position, Base)
1507
					else
1508
						local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 100
1509
						Prep(Position, Base)
1510
					end
1511
				elseif Weapon.Type.Value == "Bomb" then
1512
					if Distance > 10 then
1513
						Prep(Target.Position, Target)
1514
					elseif Distance <= 10 then
1515
						Weapon.Active.Value = true
1516
						wait(2)
1517
						while Weapon ~= nil and Weapon:FindFirstChild("Handle") ~= nil and Weapon.Handle.Transparency == 1 do
1518
							Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 80, Base)
1519
							wait(0.5)
1520
						end
1521
					end
1522
				elseif Weapon.Type.Value == "Backstab" then
1523
					if Distance >= 10 then
1524
						if (script.Parent.Torso.Position - (Target.Position + Target.CFrame.lookVector * 50)).Magnitude <= 52 then
1525
							Prep(Target.Position, Target)
1526
						else
1527
							if (script.Parent.Torso.Position - (Target.Position - Target.CFrame.lookVector * 15)).Magnitude <= 5 then
1528
								Prep(Target.Position, Base)
1529
								local backstab_time = 20
1530
								while backstab_time > 1 and (script.Parent.Torso.Position - Target.Position).Magnitude >= 4 do
1531
									wait(0.1)
1532
									backstab_time = backstab_time - 1
1533
								end
1534
								if (script.Parent.Torso.Position - Target.Position).Magnitude < 4 then
1535
									Weapon.Active.Value = true
1536
								end
1537
							else
1538
								Prep(Target.Position - Target.CFrame.lookVector * 15, Base)
1539
							end
1540
						end
1541
					else
1542
						Prep(Target.Position + Vector3.new(math.random(-2, 2), 0, math.random(-2, 2)), Target)
1543
						if Distance <= 5 then
1544
							Weapon.Active.Value = true
1545
						end
1546
					end
1547
				elseif Weapon.Type.Value == "Crossbow" then
1548
					if Distance > 80 then
1549
						Prep(Target.Position, Target)
1550
					elseif Distance < 40 then
1551
						Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 100, Base)
1552
					elseif Distance <= 80 and Distance >= 40 then
1553
						Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * ((script.Parent.Torso.Position - Target.Position).Magnitude - 5), Base)
1554
						wait(0.2)
1555
						Weapon.TargetPos.Value = Target.Position + Target.Velocity / 8 + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
1556
						Weapon.Active.Value = true
1557
					end
1558
				end
1559
				IsInCombat = true
1560
			elseif Distance <= 100 then
1561
				local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 120
1562
				Prep(Position, Base)
1563
			end
1564
		end
1565
		if IsInCombat == true then
1566
			wait(0.2)
1567
		else
1568
			wait(0.6)
1569
		end
1570
	end
1571
	local Weapon = nil
1572
	local ToolCheck = script.Parent:GetChildren()
1573
	for Check = 1, #ToolCheck do
1574
		if ToolCheck[Check].ClassName == "Tool" then
1575
			Weapon = ToolCheck[Check]
1576
		end
1577
	end
1578
	if Weapon ~= nil and script.Parent.DropWeapon.Value == true then
1579
		Weapon.Parent = Workspace
1580
	elseif Weapon ~= nil then
1581
		Weapon:Remove()
1582
	end
1583
	if script.Parent:FindFirstChild("IsAZombie") ~= nil then
1584
		script.Parent.Name = "New Zombie"
1585
		script.Parent.Humanoid.MaxHealth = script.Parent.Humanoid.MaxHealth + math.random(math.random(-50, -25), math.random(25, math.random(50, 100)))
1586
		wait()
1587
		script.Parent.Humanoid.Health = script.Parent.Humanoid.MaxHealth
1588
		script.Parent.Humanoid.WalkSpeed = script.Parent.Humanoid.WalkSpeed + math.random(math.random(-200, 0), math.random(100, math.random(200, 300))) / 100
1589
		ZStat = 2
1590
		ZStat2 = 1.57
1591
		Delay(1, function()
1592
			while script.Parent:FindFirstChild("Humanoid") ~= nil and script.Parent.Humanoid.Health > 0 do
1593
				script.Parent.Humanoid.MaxHealth = math.max(0, script.Parent.Humanoid.MaxHealth - 1)
1594
				script.Parent.Humanoid.Health = math.min(script.Parent.Humanoid.Health, script.Parent.Humanoid.MaxHealth)
1595
				wait(1)
1596
			end
1597
		end)
1598
		while script.Parent.Humanoid.Health > 0 and script.Parent:FindFirstChild("IsAZombie") ~= nil do
1599
			local Distance = 100
1600
			local Target = nil
1601
			local Players = Workspace:GetChildren()
1602
			for Check = 1, #Players do
1603
				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
1604
					local ZRay = Ray.new(script.Parent.Torso.CFrame.p, (Players[Check].Torso.CFrame.p - script.Parent.Torso.CFrame.p).Unit * 100)
1605
					local ZHit, ZPos = Workspace:FindPartOnRay(ZRay, script.Parent)
1606
					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
1607
						if ZHit ~= nil and ZHit.Parent ~= nil and ZHit.Parent.Parent ~= nil and (ZHit.Parent == Players[Check] or ZHit.Parent.Parent == Players[Check]) then
1608
							if Players[Check]:FindFirstChild("ZFound") ~= nil then
1609
								Players[Check].ZFound:Remove()
1610
							end
1611
							local ZTag = Instance.new("CFrameValue", Players[Check])
1612
							ZTag.Name = "ZFound"
1613
							game:GetService("Debris"):AddItem(ZTag, 5)
1614
						end
1615
						if (Players[Check].Torso.Position - script.Parent.Torso.Position).Magnitude <= Distance then
1616
							Target = Players[Check].Torso
1617
							Distance = (Target.Position - script.Parent.Torso.Position).Magnitude
1618
						end
1619
					end
1620
				end
1621
			end
1622
			if Target == nil then
1623
				if script.Parent.Humanoid.PlatformStand == false and script.Parent.Humanoid.Sit == false then
1624
					if math.random(1, 10) == 1 and script.Parent.Wander.Value == true then
1625
						Prep(script.Parent.Torso.Position + Vector3.new(math.random(-100, 100), 0, math.random(-100, 100)), Base)
1626
					end
1627
				else
1628
					Jump()
1629
				end
1630
			elseif script.Parent.Wander.Value == true then
1631
				script.Parent.Humanoid:MoveTo(Target.Position + Vector3.new(math.random(-2, 2), 0, math.random(-2, 2)), Target)
1632
			end
1633
			wait(0.8)
1634
		end
1635
	end
1636
end)
1637
Delay(0, function() --Random Tool Usage Script
1638
	while true do
1639
		wait(math.random(40, 70 + math.random(30, 120)) / 10)
1640
		local Weapon = nil
1641
		local ToolCheck = script.Parent:GetChildren()
1642
		for Check = 1, #ToolCheck do
1643
			if ToolCheck[Check].ClassName == "Tool" then
1644
				Weapon = ToolCheck[Check]
1645
			end
1646
		end
1647
		if Weapon ~= nil and Weapon:FindFirstChild("Active") ~= nil and Weapon:FindFirstChild("TargetPos") ~= nil and Weapon:FindFirstChild("Type") ~= nil then
1648
			if Weapon.Type.Value == "HealDrink" then
1649
				Weapon.Active.Value = true
1650
			end
1651
		end
1652
	end
1653
end)
1654
Delay(1, function() --Player Customization Script
1655
	if script.Parent["Custom_Name"].Value == "" then
1656
		script.Parent.Name = "Player" ..math.random(1, 999)
1657
	else
1658
		script.Parent.Name = script.Parent["Custom_Name"].Value
1659
	end
1660
	BColors = {3, 5, 12, 18, 108, 128, 138, 224, 224, 226, 226}
1661
	SColors = {145, 146, 147, 148, 149, 150, 168, 176, 178, 179, 200}
1662
	PColors = {190, 191, 193, 1024, 1025, 1026, 1027, 1028, 1029, 1030}
1663
	BColor = BrickColor.new(BColors[math.random(1, #BColors)])
1664
	SColor = BrickColor.new(SColors[math.random(1, #SColors)])
1665
	PColor = BrickColor.new(PColors[math.random(1, #PColors)])
1666
	if script.Parent.IsOnTeam.Value == true then
1667
		SColor = script.Parent.IsOnTeam.Team.Value
1668
		PColor = SColor
1669
		if script.Parent.IsOnTeam.ShowTag.Value == true then
1670
			script.Parent.Name = script.Parent.Name .." [" ..script.Parent.IsOnTeam.Team.Value.Name .."]"
1671
		end
1672
	end
1673
	if script.Parent["Body Colors"].ForceColors.Value ~= true then
1674
		script.Parent["Body Colors"].HeadColor = BColor
1675
		script.Parent["Body Colors"].LeftArmColor = BColor
1676
		script.Parent["Body Colors"].LeftLegColor = PColor
1677
		script.Parent["Body Colors"].RightArmColor = BColor
1678
		script.Parent["Body Colors"].RightLegColor = PColor
1679
		script.Parent["Body Colors"].TorsoColor = SColor
1680
	end
1681
	script.Parent.Head.BrickColor = script.Parent["Body Colors"].HeadColor
1682
	script.Parent["Left Arm"].BrickColor = script.Parent["Body Colors"].LeftArmColor
1683
	script.Parent["Left Leg"].BrickColor = script.Parent["Body Colors"].LeftLegColor
1684
	script.Parent["Right Arm"].BrickColor = script.Parent["Body Colors"].RightArmColor
1685
	script.Parent["Right Leg"].BrickColor = script.Parent["Body Colors"].RightLegColor
1686
	script.Parent.Torso.BrickColor = script.Parent["Body Colors"].TorsoColor
1687
	if script.Parent["Force_Weapon"].Value ~= 0 then
1688
		local x = game:GetService("InsertService"):LoadAsset(script.Parent["Force_Weapon"].Value)
1689
		local c = x:GetChildren()
1690
		for i = 1, #c do
1691
			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
1692
				c[i].Parent = script.Parent
1693
				script.Parent.DropWeapon.Value = false
1694
			end
1695
		end
1696
	end
1697
	if script.Parent["Force_Hat"].Value ~= 0 then
1698
		local x = game:GetService("InsertService"):LoadAsset(script.Parent["Force_Hat"].Value)
1699
		local c = x:GetChildren()
1700
		for i = 1, #c do
1701
			if c[i].ClassName == "Hat" and c[i]:FindFirstChild("Handle") ~= nil then
1702
				c[i].Parent = script.Parent
1703
			end
1704
		end
1705
	end
1706
	if script.Parent["Force_Shirt"].Value ~= 0 then
1707
		local x = game:GetService("InsertService"):LoadAsset(script.Parent["Force_Shirt"].Value)
1708
		local c = x:GetChildren()
1709
		for i = 1, #c do
1710
			if c[i].ClassName == "Shirt" then
1711
				c[i].Parent = script.Parent
1712
			end
1713
		end
1714
	end
1715
	if script.Parent["Force_Pants"].Value ~= 0 then
1716
		local x = game:GetService("InsertService"):LoadAsset(script.Parent["Force_Pants"].Value)
1717
		local c = x:GetChildren()
1718
		for i = 1, #c do
1719
			if c[i].ClassName == "Pants" then
1720
				c[i].Parent = script.Parent
1721
			end
1722
		end
1723
	end
1724
end)
1725
wait()
1726
print("Player Bot Loaded")
1727
end))
1728
Model0.Name=targetPart.Parent.Name
1729
Model0.Torso.Touched:connect(function(h)
1730
	if h.Parent.Name==Model0.Name  then
1731
		h.Parent:BreakJoints()
1732
		Model0:remove()
1733
	end
1734
end)
1735
Model0.Torso.Position=Character.Torso.Position
1736
for i,v in pairs(mas:GetChildren()) do
1737
	v.Parent = game:GetService("Players").LocalPlayer.Character
1738
	pcall(function() v:MakeJoints() end)
1739
end
1740
mas:Destroy()
1741
for i,v in pairs(cors) do
1742
	spawn(function()
1743
		pcall(v)
1744
	end)
1745
end
1746
end
1747
1748
function yclone()
1749
1750
--Converted with ttyyuu12345's model to script plugin v4
1751
function sandbox(var,func)
1752
	local env = getfenv(func)
1753
	local newenv = setmetatable({},{
1754
		__index = function(self,k)
1755
			if k=="script" then
1756
				return var
1757
			else
1758
				return env[k]
1759
			end
1760
		end,
1761
	})
1762
	setfenv(func,newenv)
1763
	return func
1764
end
1765
cors = {}
1766
mas = Instance.new("Model",game:GetService("Lighting"))
1767
Model0 = Instance.new("Model")
1768
Model0.Name =Player.Name .."'s clone"
1769
Part1 = Instance.new("Part")
1770
SpecialMesh2 = Instance.new("SpecialMesh")
1771
Decal3 = Instance.new("Decal")
1772
Part4 = Instance.new("Part")
1773
Decal5 = Instance.new("Decal")
1774
Motor6 = Instance.new("Motor")
1775
Motor7 = Instance.new("Motor")
1776
Motor8 = Instance.new("Motor")
1777
Motor9 = Instance.new("Motor")
1778
Motor10 = Instance.new("Motor")
1779
Part11 = Instance.new("Part")
1780
Part12 = Instance.new("Part")
1781
Part13 = Instance.new("Part")
1782
Part14 = Instance.new("Part")
1783
Humanoid15 = Instance.new("Humanoid")
1784
BodyColors16 = Instance.new("BodyColors")
1785
Script17 = Instance.new("Script")
1786
Model0.Name = "Clone"
1787
Model0.Parent = mas
1788
Model0.PrimaryPart = Part1
1789
Part1.Name = "Head"
1790
Part1.Parent = Model0
1791
Part1.BrickColor = BrickColor.new("Bright yellow")
1792
Part1.FormFactor = Enum.FormFactor.Symmetric
1793
Part1.Size = Vector3.new(2, 1, 1)
1794
Part1.CFrame = CFrame.new(6.34995413, 4.50001717, 23.1599998, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1795
Part1.TopSurface = Enum.SurfaceType.Smooth
1796
Part1.Color = Color3.new(0.960784, 0.803922, 0.188235)
1797
Part1.Position = Vector3.new(6.34995413, 4.50001717, 23.1599998)
1798
Part1.Color = Color3.new(0.960784, 0.803922, 0.188235)
1799
SpecialMesh2.Parent = Part1
1800
SpecialMesh2.Scale = Vector3.new(1.25, 1.25, 1.25)
1801
SpecialMesh2.Scale = Vector3.new(1.25, 1.25, 1.25)
1802
Decal3.Name = "face"
1803
Decal3.Parent = Part1
1804
Decal3.Texture = "rbxasset://textures/face.png"
1805
Part4.Name = "Torso"
1806
Part4.Parent = Model0
1807
Part4.BrickColor = BrickColor.new("Bright blue")
1808
Part4.FormFactor = Enum.FormFactor.Symmetric
1809
Part4.Size = Vector3.new(2, 2, 1)
1810
Part4.CFrame = CFrame.new(6.34995413, 3.00001717, 23.1599998, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1811
Part4.LeftSurface = Enum.SurfaceType.Weld
1812
Part4.RightSurface = Enum.SurfaceType.Weld
1813
Part4.Color = Color3.new(0.0509804, 0.411765, 0.67451)
1814
Part4.Position = Vector3.new(6.34995413, 3.00001717, 23.1599998)
1815
Part4.Color = Color3.new(0.0509804, 0.411765, 0.67451)
1816
Decal5.Name = "roblox"
1817
Decal5.Parent = Part4
1818
Motor6.Name = "Right Shoulder"
1819
Motor6.Parent = Part4
1820
Motor6.C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
1821
Motor6.C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
1822
Motor6.Part0 = Part4
1823
Motor6.Part1 = Part12
1824
Motor6.MaxVelocity = 0.15000000596046
1825
Motor7.Name = "Left Shoulder"
1826
Motor7.Parent = Part4
1827
Motor7.C0 = CFrame.new(-1, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
1828
Motor7.C1 = CFrame.new(0.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
1829
Motor7.Part0 = Part4
1830
Motor7.Part1 = Part11
1831
Motor7.MaxVelocity = 0.15000000596046
1832
Motor8.Name = "Right Hip"
1833
Motor8.Parent = Part4
1834
Motor8.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
1835
Motor8.C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
1836
Motor8.Part0 = Part4
1837
Motor8.Part1 = Part14
1838
Motor8.MaxVelocity = 0.10000000149012
1839
Motor9.Name = "Left Hip"
1840
Motor9.Parent = Part4
1841
Motor9.C0 = CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
1842
Motor9.C1 = CFrame.new(-0.5, 1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
1843
Motor9.Part0 = Part4
1844
Motor9.Part1 = Part13
1845
Motor9.MaxVelocity = 0.10000000149012
1846
Motor10.Name = "Neck"
1847
Motor10.Parent = Part4
1848
Motor10.C0 = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
1849
Motor10.C1 = CFrame.new(0, -0.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
1850
Motor10.Part0 = Part4
1851
Motor10.Part1 = Part1
1852
Motor10.MaxVelocity = 0.10000000149012
1853
Part11.Name = "Left Arm"
1854
Part11.Parent = Model0
1855
Part11.BrickColor = BrickColor.new("Bright yellow")
1856
Part11.CanCollide = false
1857
Part11.FormFactor = Enum.FormFactor.Symmetric
1858
Part11.Size = Vector3.new(1, 2, 1)
1859
Part11.CFrame = CFrame.new(4.84995413, 3.00001717, 23.1599998, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1860
Part11.Color = Color3.new(0.960784, 0.803922, 0.188235)
1861
Part11.Position = Vector3.new(4.84995413, 3.00001717, 23.1599998)
1862
Part11.Color = Color3.new(0.960784, 0.803922, 0.188235)
1863
Part12.Name = "Right Arm"
1864
Part12.Parent = Model0
1865
Part12.BrickColor = BrickColor.new("Bright yellow")
1866
Part12.CanCollide = false
1867
Part12.FormFactor = Enum.FormFactor.Symmetric
1868
Part12.Size = Vector3.new(1, 2, 1)
1869
Part12.CFrame = CFrame.new(7.84995413, 3.00001717, 23.1599998, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1870
Part12.Color = Color3.new(0.960784, 0.803922, 0.188235)
1871
Part12.Position = Vector3.new(7.84995413, 3.00001717, 23.1599998)
1872
Part12.Color = Color3.new(0.960784, 0.803922, 0.188235)
1873
Part13.Name = "Left Leg"
1874
Part13.Parent = Model0
1875
Part13.BrickColor = BrickColor.new("Br. yellowish green")
1876
Part13.CanCollide = false
1877
Part13.FormFactor = Enum.FormFactor.Symmetric
1878
Part13.Size = Vector3.new(1, 2, 1)
1879
Part13.CFrame = CFrame.new(5.84995413, 1.00001717, 23.1599998, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1880
Part13.BottomSurface = Enum.SurfaceType.Smooth
1881
Part13.TopSurface = Enum.SurfaceType.Inlet
1882
Part13.Color = Color3.new(0.643137, 0.741176, 0.278431)
1883
Part13.Position = Vector3.new(5.84995413, 1.00001717, 23.1599998)
1884
Part13.Color = Color3.new(0.643137, 0.741176, 0.278431)
1885
Part14.Name = "Right Leg"
1886
Part14.Parent = Model0
1887
Part14.BrickColor = BrickColor.new("Br. yellowish green")
1888
Part14.CanCollide = false
1889
Part14.FormFactor = Enum.FormFactor.Symmetric
1890
Part14.Size = Vector3.new(1, 2, 1)
1891
Part14.CFrame = CFrame.new(6.84995413, 1.00001717, 23.1599998, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1892
Part14.BottomSurface = Enum.SurfaceType.Smooth
1893
Part14.TopSurface = Enum.SurfaceType.Inlet
1894
Part14.Color = Color3.new(0.643137, 0.741176, 0.278431)
1895
Part14.Position = Vector3.new(6.84995413, 1.00001717, 23.1599998)
1896
Part14.Color = Color3.new(0.643137, 0.741176, 0.278431)
1897
Humanoid15.Parent = Model0
1898
Humanoid15.NameOcclusion = Enum.NameOcclusion.NoOcclusion
1899
Humanoid15.RightLeg = Part14
1900
Humanoid15.LeftLeg = Part13
1901
Humanoid15.Torso = Part4
1902
BodyColors16.Parent = Model0
1903
BodyColors16.HeadColor = BrickColor.new("Bright yellow")
1904
BodyColors16.LeftArmColor = BrickColor.new("Bright yellow")
1905
BodyColors16.LeftLegColor = BrickColor.new("Br. yellowish green")
1906
BodyColors16.RightArmColor = BrickColor.new("Bright yellow")
1907
BodyColors16.RightLegColor = BrickColor.new("Br. yellowish green")
1908
BodyColors16.TorsoColor = BrickColor.new("Bright blue")
1909
Script17.Name = "Full Animation"
1910
Script17.Parent = Model0
1911
table.insert(cors,sandbox(Script17,function()
1912
--[[Made by Jammer622 @[http://www.roblox.com/Advanced-Player-AI-item?id=59391730],
1913
This is the ORIGINAL model, if you see others, they are stolen.
1914
Scripts mixed from vanilla Animate, Health, and Sound,
1915
with much custom content by myself, making them great AIs.
1916
No help from Miked's scripts, I made my own joint script.
1917
If you find any glitches, bugs, or just want to suggest an idea, please message me.
1918
My team works hard on these AIs, please don't make attempts to steal them.
1919
Your feedback is extremely appreciated!
1920
1921
	_---=CREDITS=---_
1922
The Roblox Team		Without them, none of this would be possible.
1923
	Vanilla Sound
1924
	Vanilla Health
1925
	Vanilla Animate
1926
Jammer622				That's me, main programmer and weapon publisher.
1927
	Main Developer
1928
	Health GUI Script
1929
	Animation Work
1930
	Relationship Work
1931
	Wandering
1932
	Pathing (Map Generation)
1933
	Weapon Usage
1934
	Weapon (Re)Publishing
1935
		Sonypony458
1936
			McDonalds Drink
1937
	Customization
1938
	Teamwork AI
1939
	Model Variables
1940
	Setting Wiki [Below]
1941
Macdeath					I owe it to him for keeping me on track during this.
1942
	Feature Inspiration
1943
	Problem Solving
1944
	Suggestions
1945
lah30303					Amazing pathing work goes to this fine sir.
1946
	Pathing (Pathing Generation/System)
1947
1948
	_---=SETTINGS=---_
1949
Inside this model's file, you'll find several values that can be changed.
1950
	DropWeapon					-This sets whether or not the bot will drop any equipped weapon upon dying.
1951
	Force_Pants					-This must be set through Spawners.
1952
	Force_Shirt					-This must be set through Spawners.
1953
	Force_Weapon				-This must be set through Spawners.
1954
	Force_Hat					-This must be set through Spawners.
1955
	IgnoreCombatFF				-This sets whether or not the bot will allow friendly fire during combat.
1956
	IsAPlayer					-This is a tag to specify this bot's existance to other AIs.
1957
	IsOnTeam						-This sets whether or not the bot is on a team.
1958
		ShowTag					-This sets whether or not the bot's team color name shows up beside its own.
1959
		Team						-This sets the bot's team color.
1960
	PathTo						-This is an experimental pathfinding engine. Use at your own risk!
1961
	PrintMap						-This prints maps generated when using PathTo. Use at your own risk!
1962
	Respawn						-This sets whether the bot will respawn or not upon death.
1963
	Custom_Name					-This must be set through Spawners.
1964
	Wander						-This sets whether the bot is stationary or if it moves, but not if it uses weapons or not.
1965
]]
1966
print("Player Bot Loading")
1967
Delay(0, function() --Vanilla Sound
1968
	function waitForChild(parent, childName)
1969
		local child = parent:findFirstChild(childName)
1970
		if child then return child end
1971
		while true do
1972
			child = parent.ChildAdded:wait()
1973
			if child.Name==childName then return child end
1974
		end
1975
	end
1976
	function newSound(id)
1977
		local sound = Instance.new("Sound")
1978
		sound.SoundId = id
1979
		sound.archivable = false
1980
		sound.Parent = script.Parent.Head
1981
		return sound
1982
	end
1983
	local sDied = newSound("rbxasset://sounds/uuhhh.wav")
1984
	local sFallingDown = newSound("rbxasset://sounds/splat.wav")
1985
	local sFreeFalling = newSound("rbxasset://sounds/swoosh.wav")
1986
	local sGettingUp = newSound("rbxasset://sounds/hit.wav")
1987
	local sJumping = newSound("rbxasset://sounds/button.wav")
1988
	local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3")
1989
	sRunning.Looped = true
1990
	local Figure = script.Parent
1991
	local Head = waitForChild(Figure, "Head")
1992
	local Humanoid = waitForChild(Figure, "Humanoid")
1993
	function onDied()
1994
		sDied:Play()
1995
	end
1996
	function onState(state, sound)
1997
		if state then
1998
			sound:Play()
1999
		else
2000
			sound:Pause()
2001
		end
2002
	end
2003
	function onRunning(speed)
2004
		if speed>0 then
2005
			sRunning:Play()
2006
		else
2007
			sRunning:Pause()
2008
		end
2009
	end
2010
	
2011
	Humanoid.Died:connect(onDied)
2012
	Humanoid.Running:connect(onRunning)
2013
	Humanoid.Jumping:connect(function(state) onState(state, sJumping) end)
2014
	Humanoid.GettingUp:connect(function(state) onState(state, sGettingUp) end)
2015
	Humanoid.FreeFalling:connect(function(state) onState(state, sFreeFalling) end)
2016
	Humanoid.FallingDown:connect(function(state) onState(state, sFallingDown) end)
2017
end)
2018
Delay(0, function() --Vanilla Health
2019
	function waitForChild(parent, childName)
2020
		local child = parent:findFirstChild(childName)
2021
		if child then return child end
2022
		while true do
2023
			child = parent.ChildAdded:wait()
2024
			if child.Name==childName then return child end
2025
		end
2026
	end
2027
	local Figure = script.Parent
2028
	local Humanoid = waitForChild(Figure, "Humanoid")
2029
	local regening = false
2030
	function regenHealth()
2031
		if regening then return end
2032
		regening = true
2033
		while Humanoid.Health < Humanoid.MaxHealth do
2034
			local s = wait(1)
2035
			local health = Humanoid.Health
2036
			if health > 0 and health < Humanoid.MaxHealth then
2037
				local newHealthDelta = 0.01 * s * Humanoid.MaxHealth
2038
				health = health + newHealthDelta
2039
				Humanoid.Health = math.min(health,Humanoid.MaxHealth)
2040
			end
2041
		end
2042
		if Humanoid.Health > Humanoid.MaxHealth then
2043
			Humanoid.Health = Humanoid.MaxHealth
2044
		end
2045
		regening = false
2046
	end
2047
	Humanoid.HealthChanged:connect(regenHealth)
2048
end)
2049
Delay(0, function() --Vanilla Animate, Multiple Additions
2050
	function waitForChild(parent, childName)
2051
		local child = parent:findFirstChild(childName)
2052
		if child then return child end
2053
		while true do
2054
			child = parent.ChildAdded:wait()
2055
			if child.Name==childName then return child end
2056
		end
2057
	end
2058
	local Figure = script.Parent
2059
	local Clone = Figure:Clone()
2060
	local Torso = waitForChild(Figure, "Torso")
2061
	local Joints = Torso:GetChildren()
2062
	for All = 1, #Joints do
2063
		if Joints.className == "Motor" or Joints.className == "Motor6D" then
2064
			Joints[All]:Remove()
2065
		end
2066
	end
2067
	local RightShoulder = Instance.new("Motor")
2068
	local LeftShoulder = Instance.new("Motor")
2069
	local RightHip = Instance.new("Motor")
2070
	local LeftHip = Instance.new("Motor")
2071
	local Neck = Instance.new("Motor")
2072
	local Humanoid = waitForChild(Figure, "Humanoid")
2073
	ZStat = 1
2074
	ZStat2 = 0
2075
	local pose = "Standing"
2076
	RightShoulder.Part0 = Torso
2077
	RightShoulder.Part1 = Figure["Right Arm"]
2078
	RightShoulder.MaxVelocity = 0.15
2079
	RightShoulder.Name = "Right Shoulder"
2080
	RightShoulder.C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
2081
	RightShoulder.C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
2082
	RightShoulder.Parent = Torso
2083
	LeftShoulder.Part0 = Torso
2084
	LeftShoulder.Part1 = Figure["Left Arm"]
2085
	LeftShoulder.MaxVelocity = 0.15
2086
	LeftShoulder.Name = "Left Shoulder"
2087
	LeftShoulder.C0 = CFrame.new(-1, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
2088
	LeftShoulder.C1 = CFrame.new(0.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
2089
	LeftShoulder.Parent = Torso
2090
	RightHip.Part0 = Torso
2091
	RightHip.Part1 = Figure["Right Leg"]
2092
	RightHip.MaxVelocity = 0.1
2093
	RightHip.Name = "Right Hip"
2094
	RightHip.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
2095
	RightHip.C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
2096
	RightHip.Parent = Torso
2097
	LeftHip.Part0 = Torso
2098
	LeftHip.Part1 = Figure["Left Leg"]
2099
	LeftHip.MaxVelocity = 0.1
2100
	LeftHip.Name = "Left Hip"
2101
	LeftHip.C0 = CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
2102
	LeftHip.C1 = CFrame.new(-0.5, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
2103
	LeftHip.Parent = Torso
2104
	Neck.Part0 = Torso
2105
	Neck.Part1 = Figure["Head"]
2106
	Neck.MaxVelocity = 0.1
2107
	Neck.Name = "Neck"
2108
	Neck.C0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
2109
	Neck.C1 = CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
2110
	Neck.Parent = Torso
2111
	local toolAnim = "None"
2112
	local toolAnimTime = 0
2113
	SpawnModel = Instance.new("Model")
2114
	function onRunning(speed)
2115
		if speed>0 then
2116
			pose = "Running"
2117
		else
2118
			pose = "Standing"
2119
		end
2120
	end
2121
	function CheckTag(Tag)
2122
		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
2123
			if Tag.Value.Character:FindFirstChild("IsLocalEnemy") == nil then
2124
				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
2125
					local Tag2 = Instance.new("CFrameValue", Tag.Value.Character)
2126
					Tag2.Name = "IsLocalEnemy"
2127
					print(Tag.Value.Character.Name .." Has Become An Outlaw")
2128
				end
2129
			end
2130
			if Tag.Value.Character:FindFirstChild("Loc" ..script.Parent.Name) ~= nil then
2131
				Tag.Value.Character:FindFirstChild("Loc" ..script.Parent.Name):Remove()
2132
			end
2133
			local Found = Instance.new("CFrameValue", Tag.Value.Character)
2134
			Found.Name = "Loc" ..script.Parent.Name
2135
			game:GetService("Debris"):AddItem(Found, 3)
2136
		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
2137
			if game.Players[Tag.Value].Character:FindFirstChild("IsLocalEnemy") == nil then
2138
				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
2139
					local Tag2 = Instance.new("CFrameValue", game.Players[Tag.Value].Character)
2140
					Tag2.Name = "IsLocalEnemy"
2141
					print(Tag.Value .." Has Become An Outlaw")
2142
				end
2143
			end
2144
			if game.Players[Tag.Value].Character:FindFirstChild("Loc" ..script.Parent.Name) ~= nil then
2145
				game.Players[Tag.Value].Character:FindFirstChild("Loc" ..script.Parent.Name):Remove()
2146
			end
2147
			local Found = Instance.new("CFrameValue", game.Players[Tag.Value].Character)
2148
			Found.Name = "Loc" ..script.Parent.Name
2149
			game:GetService("Debris"):AddItem(Found, 3)
2150
		elseif script.Parent:FindFirstChild("IsLocalEnemy") == nil and script.Parent:FindFirstChild("IsAZombie") == nil and Tag.ClassName == "StringValue" and game.Workspace:FindFirstChild(Tag.Value) ~= nil then
2151
			if game.Workspace[Tag.Value]:FindFirstChild("IsLocalEnemy") == nil then
2152
				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
2153
					local Tag2 = Instance.new("CFrameValue", game.Workspace[Tag.Value])
2154
					Tag2.Name = "IsLocalEnemy"
2155
					print(Tag.Value .." Has Become An Outlaw")
2156
				end
2157
			end
2158
			if game.Workspace[Tag.Value]:FindFirstChild("Loc" ..script.Parent.Name) ~= nil then
2159
				game.Workspace[Tag.Value]:FindFirstChild("Loc" ..script.Parent.Name):Remove()
2160
			end
2161
			local Found = Instance.new("CFrameValue", game.Workspace[Tag.Value])
2162
			Found.Name = "Loc" ..script.Parent.Name
2163
			game:GetService("Debris"):AddItem(Found, 3)
2164
		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
2165
			local Found = Instance.new("CFrameValue", Tag.Value.Character)
2166
			Found.Name = "Loc" ..script.Parent.Name
2167
			game:GetService("Debris"):AddItem(Found, 3)
2168
		elseif (script.Parent:FindFirstChild("IsLocalEnemy") ~= nil or script.Parent:FindFirstChild("IsAZombie") ~= nil) and Tag.ClassName == "StringValue" and game.Workspace:FindFirstChild(Tag.Value) ~= nil then
2169
			local Found = Instance.new("CFrameValue", game.Workspace[Tag.Value])
2170
			Found.Name = "Loc" ..script.Parent.Name
2171
			game:GetService("Debris"):AddItem(Found, 3)
2172
		end
2173
	end
2174
	function CheckSpawns(Object)
2175
		local Parts = Object:GetChildren()
2176
		for Check = 1, #Parts do
2177
			if Parts[Check].className == "SpawnLocation" then
2178
				local I = Instance.new("Vector3Value", SpawnModel)
2179
				I.Value = Parts[Check].Position
2180
			end
2181
			CheckSpawns(Parts[Check])
2182
		end
2183
	end
2184
	function onDied()
2185
		pose = "Dead"
2186
		Delay(5, function()
2187
			if script.Parent.Respawn.Value == true then
2188
				CheckSpawns(Workspace)
2189
				local Spawn = SpawnModel:GetChildren()
2190
				Clone.Parent = game.Workspace
2191
				if #Spawn > 0 then
2192
					Spawn = Spawn[math.random(1, #Spawn)].Value
2193
					Clone:MoveTo(Spawn)
2194
				else
2195
					Clone:MoveTo(Vector3.new(0, 50, 0))
2196
				end
2197
			end
2198
			Figure:Remove()
2199
			return
2200
		end)
2201
	end
2202
	function onJumping()
2203
		pose = "Jumping"
2204
	end
2205
	function onClimbing()
2206
		pose = "Climbing"
2207
	end
2208
	function onGettingUp()
2209
		pose = "GettingUp"
2210
	end
2211
	function onFreeFall()
2212
		pose = "FreeFall"
2213
	end
2214
	function onFallingDown()
2215
		pose = "FallingDown"
2216
	end
2217
	function onSeated()
2218
		pose = "Seated"
2219
	end
2220
	function onPlatformStanding()
2221
		pose = "PlatformStanding"
2222
	end
2223
	function moveJump()
2224
		RightShoulder.MaxVelocity = 0.5
2225
		LeftShoulder.MaxVelocity = 0.5
2226
		RightShoulder.DesiredAngle = (3.14/ZStat)
2227
		LeftShoulder.DesiredAngle = (-3.14/ZStat)
2228
		RightHip.DesiredAngle = (0)
2229
		LeftHip.DesiredAngle = (0)
2230
	end
2231
	function moveFreeFall()
2232
		RightShoulder.MaxVelocity = 0.5
2233
		LeftShoulder.MaxVelocity = 0.5
2234
		RightShoulder.DesiredAngle = (3.14/ZStat)
2235
		LeftShoulder.DesiredAngle = (-3.14/ZStat)
2236
		RightHip.DesiredAngle = (0)
2237
		LeftHip.DesiredAngle = (0)
2238
	end
2239
	function moveSit()
2240
		RightShoulder.MaxVelocity = 0.15
2241
		LeftShoulder.MaxVelocity = 0.15
2242
		RightShoulder.DesiredAngle = (3.14 /2)
2243
		LeftShoulder.DesiredAngle = (-3.14 /2)
2244
		RightHip.DesiredAngle = (3.14 /2)
2245
		LeftHip.DesiredAngle = (-3.14 /2)
2246
	end
2247
	function getTool()	
2248
		for _, kid in ipairs(Figure:GetChildren()) do
2249
			if kid.className == "Tool" then return kid end
2250
		end
2251
		return nil
2252
	end
2253
	function getToolAnim(tool)
2254
		for _, c in ipairs(tool:GetChildren()) do
2255
			if c.Name == "toolanim" and c.className == "StringValue" then
2256
				return c
2257
			end
2258
		end
2259
		return nil
2260
	end
2261
	function animateTool()
2262
		if (toolAnim == "None") then
2263
			RightShoulder.DesiredAngle = (1.57)
2264
			return
2265
		end
2266
		if (toolAnim == "Slash") then
2267
			RightShoulder.MaxVelocity = 0.5
2268
			RightShoulder.DesiredAngle = (0)
2269
			return
2270
		end
2271
		if (toolAnim == "Lunge") then
2272
			RightShoulder.MaxVelocity = 0.5
2273
			LeftShoulder.MaxVelocity = 0.5
2274
			RightHip.MaxVelocity = 0.5
2275
			LeftHip.MaxVelocity = 0.5
2276
			RightShoulder.DesiredAngle = (1.57)
2277
			LeftShoulder.DesiredAngle = (1.0)
2278
			RightHip.DesiredAngle = (1.57)
2279
			LeftHip.DesiredAngle = (1.0)
2280
			return
2281
		end
2282
	end
2283
	function move(time)
2284
		local amplitude
2285
		local frequency
2286
		if (pose == "Jumping") then
2287
			moveJump()
2288
			return
2289
		end
2290
		if (pose == "FreeFall") then
2291
			moveFreeFall()
2292
			return
2293
		end	 
2294
		if (pose == "Seated") then
2295
			moveSit()
2296
			return
2297
		end
2298
		local climbFudge = 0
2299
		if (pose == "Running") then
2300
			RightShoulder.MaxVelocity = 0.15
2301
			LeftShoulder.MaxVelocity = 0.15
2302
			amplitude = 1
2303
			frequency = 9
2304
		elseif (pose == "Climbing") then
2305
			RightShoulder.MaxVelocity = 0.5 
2306
			LeftShoulder.MaxVelocity = 0.5
2307
			amplitude = 1
2308
			frequency = 9
2309
			climbFudge = 3.14
2310
		else
2311
			amplitude = 0.1
2312
			frequency = 1
2313
		end
2314
		desiredAngle = amplitude * math.sin(time*frequency)
2315
		RightShoulder.DesiredAngle = (desiredAngle + climbFudge) + ZStat2
2316
		LeftShoulder.DesiredAngle = (desiredAngle - climbFudge) -ZStat2
2317
		RightHip.DesiredAngle = (-desiredAngle)
2318
		LeftHip.DesiredAngle = (-desiredAngle)
2319
		local tool = getTool()
2320
		if tool then
2321
			animStringValueObject = getToolAnim(tool)
2322
			if animStringValueObject then
2323
				toolAnim = animStringValueObject.Value
2324
				animStringValueObject.Parent = nil
2325
				toolAnimTime = time + .3
2326
			end
2327
			if time > toolAnimTime then
2328
				toolAnimTime = 0
2329
				toolAnim = "None"
2330
			end
2331
			animateTool()
2332
		else
2333
			toolAnim = "None"
2334
			toolAnimTime = 0
2335
		end
2336
	end
2337
	Humanoid.Died:connect(onDied)
2338
	Humanoid.Running:connect(onRunning)
2339
	Humanoid.Jumping:connect(onJumping)
2340
	Humanoid.Climbing:connect(onClimbing)
2341
	Humanoid.GettingUp:connect(onGettingUp)
2342
	Humanoid.FreeFalling:connect(onFreeFall)
2343
	Humanoid.FallingDown:connect(onFallingDown)
2344
	Humanoid.Seated:connect(onSeated)
2345
	Humanoid.PlatformStanding:connect(onPlatformStanding)
2346
	Humanoid.ChildAdded:connect(CheckTag)
2347
	OriginalTime = 0.1
2348
	Time = OriginalTime
2349
	while Figure.Parent~=nil do
2350
		Time = Time + 0.1
2351
		wait(OriginalTime)
2352
		move(Time)
2353
	end
2354
end)
2355
Delay(0, function() --lah30303's Pathing Script
2356
	function CalcMoves(map, px, py, tx, ty) 
2357
		if map[ty][tx] ~= 0 then
2358
			return nil
2359
		end
2360
		local openlist, closedlist, listk, closedk, tempH, tempG, xsize, ysize, curbase = {}, {}, 1, 0, math.abs(px - tx) + math.abs(py - ty), 0, #map[1], #map, {}
2361
		openlist[1] = {x = px, y = py, g = 0, h = tempH, f = 0 + tempH ,par = 1}
2362
		local nodenumber = 0
2363
		while listk > 0 do
2364
			nodenumber = nodenumber + 1
2365
			if nodenumber / ScanSkip == math.floor(nodenumber / ScanSkip) then
2366
				wait()
2367
				if DebugPathing == true then
2368
					print("Node", nodenumber)
2369
				end
2370
			end
2371
			closedk = closedk + 1
2372
			table.insert(closedlist, closedk, openlist[1])
2373
			curbase = closedlist[closedk]
2374
			if closedlist[closedk].x == tx and closedlist[closedk].y == ty then
2375
				return closedlist
2376
			end
2377
			openlist[1] = openlist[listk]
2378
			table.remove(openlist, listk)
2379
			listk = listk - 1
2380
			local v = 1
2381
			while true do
2382
				local u = v
2383
				if 2 * u + 1 <= listk then
2384
					if openlist[u].f >= openlist[2 * u].f then
2385
						v = 2 * u
2386
					end
2387
					if openlist[v].f >= openlist[2 * u + 1].f then
2388
						v = 2 * u + 1
2389
					end
2390
				elseif 2 * u <= listk then
2391
					if openlist[u].f >= openlist[2 * u].f then
2392
						v = 2 * u
2393
					end
2394
				end
2395
				if u ~= v then
2396
					local temp = openlist[u]
2397
					openlist[u] = openlist[v]
2398
					openlist[v] = temp
2399
				else
2400
					break
2401
				end
2402
			end
2403
2404
			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
2405
			if closedk > 0 then
2406
				for k = 1, closedk do
2407
					for i, v in pairs(tocheck) do
2408
						if closedlist[k].x == curbase.x + v[1] and closedlist[k].y == curbase.y + v[2] then
2409
							tocheck[i] = nil
2410
						end
2411
					end
2412
				end
2413
			end
2414
			for i, v in pairs(tocheck) do
2415
				local a = curbase.x + v[1]
2416
				local b = curbase.y + v[2]
2417
				if a > xsize or a < 1 or b > ysize or b < 1 then
2418
					tocheck[i] = nil
2419
				end
2420
			end
2421
			for i, v in pairs(tocheck) do
2422
				local a, b = curbase.x + v[1], curbase.y + v[2]
2423
				if a <= xsize and a >= 1 and b <= ysize and b >= 1 and map[b][a] ~= 0 then
2424
					tocheck[i] = nil
2425
				end
2426
			end
2427
			tempG = curbase.g + 1
2428
			tempDiagG = curbase.g + 1.4
2429
			for k = 1, listk do
2430
				for i, v in pairs(tocheck) do
2431
					if openlist[k].x == curbase.x + v[1] and openlist[k].y == curbase.y + 1 and openlist[k].g > tempG then
2432
						tempH = math.abs((curbase.x + v[1])-tx) + math.abs((curbase.y + v[1])-ty)
2433
						table.insert(openlist, k, {x = curbase.x + v[1], y = curbase.y + v[2], g = tempG, h = tempH, f = tempG + tempH, par = closedk})
2434
						local m = k
2435
						while m ~= 1 do
2436
							if openlist[m].f <= openlist[math.floor(m/2)].f then
2437
								temp = openlist[math.floor(m/2)]
2438
								openlist[math.floor(m/2)] = openlist[m]
2439
								openlist[m] = temp
2440
								m = math.floor(m/2)
2441
							else
2442
								break
2443
							end
2444
							tocheck[i] = nil
2445
						end
2446
					end
2447
				end
2448
			end
2449
			for i, v in pairs(tocheck) do
2450
				listk = listk + 1
2451
				tempH = math.abs((curbase.x + v[1]) - tx) + math.abs((curbase.y + v[2]) - ty)
2452
				table.insert(openlist, listk, {x = curbase.x + v[1], y = curbase.y + v[2], g = tempG, h = tempH, f = tempG+tempH, par = closedk})
2453
				m = listk
2454
				while m ~= 1 do
2455
					if openlist[m].f <= openlist[math.floor(m/2)].f then
2456
						temp = openlist[math.floor(m/2)]
2457
						openlist[math.floor(m/2)] = openlist[m]
2458
						openlist[m] = temp
2459
						m = math.floor(m/2)
2460
					else
2461
						break
2462
					end
2463
				end
2464
			end
2465
		end
2466
		return nil
2467
	end
2468
2469
2470
	function CalcPath(closedlist)
2471
2472
		if closedlist == nil or table.getn(closedlist) == 1 then
2473
			return nil
2474
		end
2475
		local path = {}
2476
		local pathIndex = {}
2477
		local last = table.getn(closedlist)
2478
		table.insert(pathIndex,1,last)
2479
2480
		local i = 1
2481
		while pathIndex[i] > 1 do
2482
			i = i + 1
2483
			table.insert(pathIndex, i, closedlist[pathIndex[i - 1]].par)
2484
		end 
2485
2486
		for n = table.getn(pathIndex) - 1, 1, -1 do
2487
			table.insert(path, {x = closedlist[pathIndex[n]].x, y = closedlist[pathIndex[n]].y})
2488
		end
2489
2490
		closedlist = nil
2491
		return path
2492
	end
2493
end)
2494
Delay(0, function() --Main Artificial Intelligence Scripting/Path Grid Generator
2495
	local Base
2496
	if script.Parent:FindFirstChild("BASE") == nil then
2497
		Base = Instance.new("Part")
2498
		Base.Transparency = 1
2499
		Base.TopSurface = "Smooth"
2500
		Base.BottomSurface = "Smooth"
2501
		Base.CanCollide = false
2502
		Base.Anchored = true
2503
		Base.Locked = true
2504
		Base.BrickColor = BrickColor.new(0, 0, 0)
2505
		Base.Name = "BASE"
2506
		Base.CFrame = CFrame.new(Vector3.new(0, 0, 0))
2507
		Base.Parent = script.Parent
2508
	else
2509
		Base = script.Parent.BASE
2510
		Base.CFrame = CFrame.new(Vector3.new(0, 0, 0))
2511
	end
2512
	function Jump()
2513
		script.Parent.Humanoid.Jump = true
2514
	end
2515
	function Check(Hit)
2516
		if Hit ~= nil and Hit.Parent ~= nil and Hit.Parent.Parent ~= nil then
2517
			if Hit.Parent:FindFirstChild("Humanoid") == nil and Hit.Parent.Parent:FindFirstChild("Humanoid") == nil then
2518
				Jump()
2519
			end
2520
		end
2521
	end
2522
	script.Parent.Torso.Touched:connect(Check)
2523
	function Prep(Target, Current, Attempts)
2524
		if Attempts == nil then
2525
			Attempts = 1000
2526
		end
2527
		local Hit = false
2528
		local Tag = Base:Clone()
2529
		Tag.Position = Target
2530
		Tag.Parent = script.Parent
2531
		local TagRay = Ray.new(Tag.CFrame.p, (CFrame.new(Tag.CFrame.p - Vector3.new(0, 3, 0)).p - Tag.CFrame.p).Unit * 40)
2532
		local TRHit, TRPos = game.Workspace:FindPartOnRay(TagRay, script.Parent)
2533
		if TRHit ~= nil then
2534
			Hit = true
2535
		end
2536
		if Tag.Parent ~= nil then
2537
			Tag:Remove()
2538
		end
2539
		if Hit == false and Attempts > 0 and script.Parent.Wander.Value == true then
2540
			Prep(script.Parent.Torso.Position + Vector3.new(math.random(-100, 100), 0, math.random(-100, 100)), Base, Attempts - 1)
2541
		elseif script.Parent.Wander.Value == true then
2542
			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))
2543
			local THit, TPos = game.Workspace:FindPartOnRay(TargetRay, script.Parent)
2544
			local TrueTarget = script.Parent.Torso.Position
2545
			if THit ~= nil then
2546
				for HazardCheck = 1, math.floor((script.Parent.Torso.CFrame.p - TPos).Magnitude) do
2547
					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)
2548
					local TH2, TP2 = game.Workspace:FindPartOnRay(TR2, script.Parent)
2549
					if TH2 ~= nil and TH2.Name ~= "Lava" then
2550
						TrueTarget = TP2
2551
					else
2552
						break
2553
					end
2554
				end
2555
			else
2556
				for HazardCheck = 1, math.floor((script.Parent.Torso.CFrame.p - Target).Magnitude) do
2557
					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)
2558
					local TH2, TP2 = game.Workspace:FindPartOnRay(TR2, script.Parent)
2559
					if TH2 ~= nil and TH2.Name ~= "Lava" then
2560
						TrueTarget = TP2
2561
					else
2562
						break
2563
					end
2564
				end
2565
			end
2566
			script.Parent.Humanoid:MoveTo(TrueTarget, Current)
2567
		end
2568
	end
2569
	function ZHit(Part)
2570
		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
2571
			Part.Parent.Humanoid:TakeDamage(2)
2572
			script.Parent.Humanoid.MaxHealth = script.Parent.Humanoid.MaxHealth + 1
2573
			script.Parent.Humanoid:TakeDamage(-1)
2574
		end
2575
	end
2576
	script.Parent["Right Arm"].Touched:connect(ZHit)
2577
	script.Parent["Left Arm"].Touched:connect(ZHit)
2578
	CurrentMap = {}
2579
	MapMask = {}
2580
	MapVar = {0, 0, 0, 0, 0}
2581
	BlockScanned = 0
2582
	ScanSkip = 5
2583
	DebugPathing = true
2584
	function GenerateMap(PathPos)
2585
		CurrentMap = {}
2586
		MapMask = {}
2587
		MapVar = {0, 0, 0, 0, 0}
2588
		BlockScanned = 0
2589
		MapVariables = ScanParts(Workspace, 1)
2590
		for MapX = 1, math.max(-MapVariables[1], MapVariables[2]) * 2 + 1 do
2591
			CurrentMap[MapX] = {}
2592
			for MapY = 1, math.max(-MapVariables[3], MapVariables[4]) * 2 + 1 do
2593
				CurrentMap[MapX][MapY] = 0
2594
			end
2595
		end
2596
		for MaskX = 1, #CurrentMap do
2597
			MapMask[MaskX] = {}
2598
			for MaskY = 1, #CurrentMap[MaskX] do
2599
				MapMask[MaskX][MaskY] = {MapVariables[1] + MaskX - 0.5, MapVariables[1] + MaskY - 0.5}
2600
			end
2601
		end
2602
		ScanParts(Workspace, 2, MapVariables)
2603
		wait(1)
2604
		if script.Parent.PrintMap.Value == true then
2605
			print("Printing Map...")
2606
			for ClearPrint = 1, 250 do
2607
				wait()
2608
				print()
2609
			end
2610
			for PrintX = 1, #CurrentMap do
2611
				local PrintZ = ""
2612
				for PrintY = 1, #CurrentMap[PrintX] do
2613
					PrintZ = PrintZ ..CurrentMap[PrintX][PrintY]
2614
				end
2615
				print(PrintZ)
2616
				wait(0.1)
2617
			end
2618
		end
2619
		local MapCoords = {0, 0, 0, 0}
2620
		local Distance = math.huge
2621
		for MPX = 1, #CurrentMap do
2622
			for MPY = 1, #CurrentMap[MPX] do
2623
				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
2624
					MapCoords = {MPX, MPY, 0, 0}
2625
					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
2626
				end
2627
			end
2628
		end
2629
		local Distance = math.huge
2630
		for MPX = 1, #CurrentMap do
2631
			for MPY = 1, #CurrentMap[MPX] do
2632
				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
2633
					MapCoords = {MapCoords[1], MapCoords[2], math.min(MPX, #CurrentMap) - 1, math.min(MPY, #CurrentMap[1] - 1)}
2634
					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
2635
				end
2636
			end
2637
		end
2638
		for i, v in pairs(CalcPath(CalcMoves(CurrentMap, MapCoords[1], MapCoords[2], MapCoords[3], MapCoords[4]))) do
2639
			local Timer = 20
2640
			local pX = v["x"]
2641
			local pY = v["y"]
2642
			local pTo = Vector3.new(MapMask[pX][pY][1], 0, MapMask[pX][pY][2])
2643
			pTo = pTo + (pTo - Vector3.new(script.Parent.Torso.Position.X, 0, script.Parent.Torso.Position.Z)).Unit
2644
			while (Vector3.new(script.Parent.Torso.Position.X, 0, script.Parent.Torso.Position.Z) - pTo).Magnitude > 2.5 and Timer > 0 do
2645
				script.Parent.Humanoid:MoveTo(pTo, Base)
2646
				Timer = Timer - 1
2647
				if Timer == 10 then
2648
					script.Parent.Humanoid.Jump = true
2649
				end
2650
				wait(0.1)
2651
			end
2652
			if Timer == 0 then
2653
				if (Vector3.new(script.Parent.Torso.Position.X, 0, script.Parent.Torso.Position.Z) - pTo).Magnitude <= 5 then
2654
					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
2655
				else
2656
					break
2657
				end
2658
			end
2659
		end
2660
	end
2661
	function ScanParts(CurrentModel, CurrentStage, Variables)
2662
		local X = CurrentModel:GetChildren()
2663
		for I = 1, #X do
2664
			if #X[I]:GetChildren() > 0 then
2665
				ScanParts(X[I], 1, Variables)
2666
			end
2667
			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
2668
				BlockScanned = BlockScanned + 1
2669
				if BlockScanned / ScanSkip == math.floor(BlockScanned / ScanSkip) then
2670
					wait()
2671
					if DebugPathing == true then
2672
						print("Block", BlockScanned)
2673
					end
2674
				end
2675
				if CurrentStage == 1 then
2676
					MapVar[1] = math.min(math.ceil(X[I].Position.X - X[I].Size.X / 2), MapVar[1])
2677
					MapVar[2] = math.max(math.floor(X[I].Position.X + X[I].Size.X / 2), MapVar[2])
2678
					MapVar[3] = math.min(math.ceil(X[I].Position.Z - X[I].Size.Z / 2), MapVar[3])
2679
					MapVar[4] = math.max(math.floor(X[I].Position.Z + X[I].Size.Z / 2), MapVar[4])
2680
				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
2681
					local BlockStart = {X[I].Position.X - X[I].Size.X / 2, X[I].Position.Z - X[I].Size.Z / 2}
2682
					local BlockEnd = {X[I].Position.X + X[I].Size.X / 2, X[I].Position.Z + X[I].Size.Z / 2}
2683
					local BlockCoords = {0, 0, 0, 0}
2684
					local Distance = math.huge
2685
					for MPX = 1, #CurrentMap do
2686
						for MPY = 1, #CurrentMap[MPX] do
2687
							if (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(BlockStart[1], 0, BlockStart[2])).Magnitude < Distance then
2688
								BlockCoords = {MPX, MPY, 0, 0}
2689
								Distance = (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(BlockStart[1], 0, BlockStart[2])).Magnitude
2690
							end
2691
						end
2692
					end
2693
					local Distance = math.huge
2694
					for MPX = 1, #CurrentMap do
2695
						for MPY = 1, #CurrentMap[MPX] do
2696
							if (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(BlockEnd[1], 0, BlockEnd[2])).Magnitude < Distance then
2697
								BlockCoords = {BlockCoords[1], BlockCoords[2], MPX, MPY}
2698
								Distance = (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(BlockEnd[1], 0, BlockEnd[2])).Magnitude
2699
							end
2700
						end
2701
					end
2702
					for XGrid = BlockCoords[2], BlockCoords[4] do
2703
						for YGrid = BlockCoords[1], BlockCoords[3] do
2704
							CurrentMap[XGrid][YGrid] = 1
2705
						end
2706
					end
2707
				end
2708
			end
2709
		end
2710
		if CurrentStage == 1 then
2711
			MapVar[5] = {MapVar[1] + MapVar[2] / 2, MapVar[3] + MapVar[4] / 2}
2712
			return MapVar
2713
		end
2714
	end
2715
	IsInCombat = false
2716
	while script.Parent.Humanoid.Health > 0 and script.Parent:FindFirstChild("IsAZombie") == nil do
2717
		local Distance = 100
2718
		local Target = nil
2719
		IsInCombat = false
2720
		local Players = Workspace:GetChildren()
2721
		for Check = 1, #Players do
2722
			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
2723
				local Ray = Ray.new(script.Parent.Torso.CFrame.p, (Players[Check].Torso.CFrame.p - script.Parent.Torso.CFrame.p).Unit * 100)
2724
				local Hit, Position = game.Workspace:FindPartOnRay(Ray, script.Parent)
2725
				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
2726
					local TeamTag = nil
2727
					local Parts = Players[Check]:GetChildren()
2728
					for X = 1, #Parts do
2729
						if Parts[X].Name == "TeamLoc" then
2730
							if Parts[X].Value == script.Parent.IsOnTeam.Team.Value then
2731
								TeamTag = Parts[X]
2732
							end
2733
						end
2734
					end
2735
					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
2736
						if script.Parent.IsOnTeam.Value == false then
2737
							if Players[Check]:FindFirstChild("Loc" ..script.Parent.Name) ~= nil then
2738
								Players[Check]:FindFirstChild("Loc" ..script.Parent.Name):Remove()
2739
							end
2740
							local Found = Instance.new("CFrameValue", Players[Check])
2741
							Found.Name = "Loc" ..script.Parent.Name
2742
							game:GetService("Debris"):AddItem(Found, 3)
2743
						else
2744
							if Parts[X] ~= nil then
2745
								Parts[X]:Remove()
2746
							end
2747
							local Found = Instance.new("BrickColorValue", Players[Check])
2748
							Found.Name = "TeamLoc"
2749
							Found.Value = script.Parent.IsOnTeam.Team.Value
2750
							game:GetService("Debris"):AddItem(Found, 3)
2751
							if Players[Check]:FindFirstChild("Loc" ..script.Parent.Name) ~= nil then
2752
								Players[Check]:FindFirstChild("Loc" ..script.Parent.Name):Remove()
2753
							end
2754
							local Found = Instance.new("CFrameValue", Players[Check])
2755
							Found.Name = "Loc" ..script.Parent.Name
2756
							game:GetService("Debris"):AddItem(Found, 3)
2757
						end
2758
					end
2759
					if Players[Check]:FindFirstChild("Loc" ..script.Parent.Name) ~= nil and (Players[Check].Torso.Position - script.Parent.Torso.Position).Magnitude <= Distance then
2760
						Target = Players[Check].Torso
2761
						Distance = (Target.Position - script.Parent.Torso.Position).Magnitude
2762
					end
2763
				end
2764
			end
2765
		end
2766
		if Target == nil then
2767
			local HasTool = false
2768
			local ToolCheck = script.Parent:GetChildren()
2769
			for Check = 1, #ToolCheck do
2770
				if ToolCheck[Check].ClassName == "Tool" then
2771
					HasTool = true
2772
				end
2773
			end
2774
			if HasTool == false then
2775
				Distance = 100
2776
				for Check = 1, #Players do
2777
					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
2778
						local Ray = Ray.new(script.Parent.Torso.CFrame.p, (Players[Check].Handle.CFrame.p - script.Parent.Torso.CFrame.p).Unit * 100)
2779
						local Hit, Position = game.Workspace:FindPartOnRay(Ray, script.Parent)
2780
						if Hit ~= nil and Hit.Parent ~= nil and Hit.Parent == Players[Check] then
2781
							Distance = (Players[Check].Handle.Position - script.Parent.Torso.Position).Magnitude
2782
							Target = Players[Check]
2783
						end
2784
					end
2785
				end
2786
				if Target ~= nil and Target.ClassName == "Tool" then
2787
					if Distance <= 5 and HasTool == false then
2788
						Target.Parent = script.Parent
2789
						HasTool = true
2790
					else
2791
						Prep(Target.Handle.Position, Base)
2792
					end
2793
				else
2794
					for Check = 1, #Players do
2795
						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
2796
							local Ray = Ray.new(script.Parent.Torso.CFrame.p, (Players[Check].CFrame.p - script.Parent.Torso.CFrame.p).Unit * 100)
2797
							local Hit, Position = game.Workspace:FindPartOnRay(Ray, script.Parent)
2798
							if Hit ~= nil and Hit == Players[Check] then
2799
								Target = Players[Check]
2800
								Distance = (Target.Position - script.Parent.Torso.Position).Magnitude
2801
							end
2802
						end
2803
					end
2804
					if Target ~= nil then
2805
						script.Parent.Humanoid:MoveTo(Target.Position, Target)
2806
						if (Target.Position - script.Parent.Torso.Position).Magnitude <= 10 then
2807
							Target.OpenCrate.Value = true
2808
						end
2809
					else
2810
						local HasHat = false
2811
						local HatCheck = script.Parent:GetChildren()
2812
						for Check = 1, #HatCheck do
2813
							if ToolCheck[Check].ClassName == "Hat" then
2814
								HasHat = true
2815
							end
2816
						end
2817
						if HasHat == false then
2818
							Distance = 100
2819
							for Check = 1, #Players do
2820
								if Players[Check].ClassName == "Hat" and Players[Check]:FindFirstChild("Handle") ~= nil and (Players[Check].Handle.Position - script.Parent.Torso.Position).Magnitude <= Distance then
2821
									local Ray = Ray.new(script.Parent.Torso.CFrame.p, (Players[Check].Handle.CFrame.p - script.Parent.Torso.CFrame.p).Unit * 100)
2822
									local Hit, Position = game.Workspace:FindPartOnRay(Ray, script.Parent)
2823
									if Hit ~= nil and Hit.Parent ~= nil and Hit.Parent == Players[Check] then
2824
										Distance = (Players[Check].Handle.Position - script.Parent.Torso.Position).Magnitude
2825
										Target = Players[Check]
2826
									end
2827
								end
2828
							end
2829
							if Target ~= nil and Target.ClassName == "Hat" then
2830
								if Distance <= 5 and HasHat == false then
2831
									Target.Parent = script.Parent
2832
									HasHat = true
2833
								else
2834
									Prep(Target.Handle.Position, Base)
2835
								end
2836
							else
2837
								if script.Parent.Humanoid.PlatformStand == false and script.Parent.Humanoid.Sit == false then
2838
									if script.Parent.PathTo.Value ~= Vector3.new(0, 0, 0) then
2839
										GenerateMap(script.Parent.PathTo.Value)
2840
										script.Parent.PathTo.Value = Vector3.new(0, 0, 0)
2841
									elseif math.random(1, 10) == 1 and script.Parent.Wander.Value == true then
2842
										Prep(script.Parent.Torso.Position + Vector3.new(math.random(-100, 100), 0, math.random(-100, 100)), Base)
2843
									end
2844
								else
2845
									Jump()
2846
								end
2847
							end
2848
						end
2849
					end
2850
				end
2851
			else
2852
				if Target == nil then
2853
					local Distance = 80
2854
					local Players = Workspace:GetChildren()
2855
					for Check = 1, #Players do
2856
						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
2857
							local Ray = Ray.new(script.Parent.Torso.CFrame.p, (Players[Check].Torso.CFrame.p - script.Parent.Torso.CFrame.p).Unit * 100)
2858
							local Hit, Position = game.Workspace:FindPartOnRay(Ray, script.Parent)
2859
							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
2860
								Target = Players[Check].Torso
2861
								Distance = (Target.Position - script.Parent.Torso.Position).Magnitude
2862
							end
2863
						end
2864
					end
2865
					if Target ~= nil then
2866
						local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 10
2867
						Prep(Position, Base)
2868
					else
2869
						if script.Parent.Humanoid.PlatformStand == false and script.Parent.Humanoid.Sit == false then
2870
							if script.Parent.PathTo.Value ~= Vector3.new(0, 0, 0) then
2871
								GenerateMap(script.Parent.PathTo.Value)
2872
								script.Parent.PathTo.Value = Vector3.new(0, 0, 0)
2873
							elseif math.random(1, 10) == 1 and script.Parent.Wander.Value == true then
2874
								Prep(script.Parent.Torso.Position + Vector3.new(math.random(-100, 100), 0, math.random(-100, 100)), Base)
2875
							end
2876
						else
2877
							Jump()
2878
						end
2879
					end
2880
				else
2881
					if script.Parent.Humanoid.PlatformStand == false and script.Parent.Humanoid.Sit == false then
2882
						if script.Parent.PathTo.Value ~= Vector3.new(0, 0, 0) then
2883
							GenerateMap(script.Parent.PathTo.Value)
2884
							script.Parent.PathTo.Value = Vector3.new(0, 0, 0)
2885
						elseif math.random(1, 10) == 1 and script.Parent.Wander.Value == true then
2886
							Prep(script.Parent.Torso.Position + Vector3.new(math.random(-100, 100), 0, math.random(-100, 100)), Base)
2887
						end
2888
					else
2889
						Jump()
2890
					end
2891
				end
2892
			end
2893
		else
2894
			local Weapon = nil
2895
			local ToolCheck = script.Parent:GetChildren()
2896
			for Check = 1, #ToolCheck do
2897
				if ToolCheck[Check].ClassName == "Tool" then
2898
					Weapon = ToolCheck[Check]
2899
				end
2900
			end
2901
			if Weapon ~= nil and Weapon:FindFirstChild("Active") ~= nil and Weapon:FindFirstChild("TargetPos") ~= nil and Weapon:FindFirstChild("Type") ~= nil then
2902
				if Weapon.Type.Value == "Melee" then
2903
					Prep(Target.Position + Vector3.new(math.random(-3, 3), 0, math.random(-3, 3)), Target)
2904
					if (Target.Position - script.Parent.Torso.Position).Magnitude <= 10 then
2905
						Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
2906
						Weapon.Active.Value = true
2907
					end
2908
				elseif Weapon.Type.Value == "Melee/Ranged" then
2909
					if Distance <= 10 then
2910
						Prep(Target.Position + Vector3.new(math.random(-3, 3), 0, math.random(-3, 3)), Target)
2911
						Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
2912
						Weapon.Active.Value = true
2913
					else
2914
						Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 40, Base)
2915
						if (Target.Position - script.Parent.Torso.Position).Magnitude <= 50 then
2916
							Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
2917
							Weapon.Active.Value = true
2918
						end
2919
					end
2920
				elseif Weapon.Type.Value == "Melee/RangedMed" then
2921
					if Distance <= 10 then
2922
						Prep(Target.Position + Vector3.new(math.random(-3, 3), 0, math.random(-3, 3)), Target)
2923
						Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
2924
						Weapon.Active.Value = true
2925
					else
2926
						Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 30, Base)
2927
						if (Target.Position - script.Parent.Torso.Position).Magnitude <= 40 then
2928
							Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
2929
							Weapon.Active.Value = true
2930
						end
2931
					end
2932
				elseif Weapon.Type.Value == "Melee/RangedClose" then
2933
					if Distance <= 10 then
2934
						Prep(Target.Position + Vector3.new(math.random(-3, 3), 0, math.random(-3, 3)), Target)
2935
						Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
2936
						Weapon.Active.Value = true
2937
					else
2938
						Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 20, Base)
2939
						if (Target.Position - script.Parent.Torso.Position).Magnitude <= 30 then
2940
							Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
2941
							Weapon.Active.Value = true
2942
						end
2943
					end
2944
				elseif Weapon.Type.Value == "Ranged" then
2945
					Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 80, Base)
2946
					Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
2947
					wait()
2948
					Weapon.Active.Value = true
2949
				elseif Weapon.Type.Value == "RangedMed" then
2950
					Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 60, Base)
2951
					if Distance <= 70 then
2952
						Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
2953
						wait()
2954
						Weapon.Active.Value = true
2955
					end
2956
				elseif Weapon.Type.Value == "RangedClose" then
2957
					Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 30, Base)
2958
					if Distance <= 40 then
2959
						Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
2960
						wait()
2961
						Weapon.Active.Value = true
2962
					end
2963
				elseif Weapon.Type.Value == "RangedAngle" and Distance <= 100 then
2964
					local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * (script.Parent.Torso.Position - Target.Position).Magnitude + Target.Velocity
2965
					script.Parent.Humanoid:MoveTo(Position, Base)
2966
					Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
2967
					wait()
2968
					Weapon.Active.Value = true
2969
				elseif Weapon.Type.Value == "RangedTactical" then
2970
					if Distance <= 30 then
2971
						local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 50
2972
						Prep(Position, Base)
2973
					elseif Distance >= 50 then
2974
						Prep(Target.Position, Target)
2975
					end
2976
					if Distance <= 50 and Distance >= 30 then
2977
						Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 40, Target.Parent.Torso)
2978
					end
2979
					if Distance <= 60 then
2980
						Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
2981
						wait()
2982
						Weapon.Active.Value = true
2983
					end
2984
				elseif Weapon.Type.Value == "Shuriken" then
2985
					if Distance <= 15 then
2986
						local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 20
2987
						Prep(Position, Base)
2988
					elseif Distance >= 30 then
2989
						Prep(Target.Position, Target)
2990
					end
2991
					if Distance <= 30 and Distance >= 15 then
2992
						Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 20, Target.Parent.Torso)
2993
					end
2994
					if Distance <= 50 then
2995
						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))
2996
						wait()
2997
						Weapon.Active.Value = true
2998
					end
2999
				elseif Weapon.Type.Value == "HealDrink" then
3000
					local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 120
3001
					Prep(Position, Base)
3002
					if script.Parent.Humanoid.Health < script.Parent.Humanoid.MaxHealth then
3003
						Weapon.Active.Value = true
3004
					end
3005
				elseif Weapon.Type.Value == "GrenadeDirect" then
3006
					if Distance >= 80 and Distance <= 100 then
3007
						Prep(Target.Position, Target)
3008
						wait(0.5)
3009
						Weapon.Active.Value = true
3010
						wait(0.5)
3011
						local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 100
3012
						Prep(Position, Base)
3013
					else
3014
						local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 100
3015
						Prep(Position, Base)
3016
					end
3017
				elseif Weapon.Type.Value == "Bomb" then
3018
					if Distance > 10 then
3019
						Prep(Target.Position, Target)
3020
					elseif Distance <= 10 then
3021
						Weapon.Active.Value = true
3022
						wait(2)
3023
						while Weapon ~= nil and Weapon:FindFirstChild("Handle") ~= nil and Weapon.Handle.Transparency == 1 do
3024
							Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 80, Base)
3025
							wait(0.5)
3026
						end
3027
					end
3028
				elseif Weapon.Type.Value == "Backstab" then
3029
					if Distance >= 10 then
3030
						if (script.Parent.Torso.Position - (Target.Position + Target.CFrame.lookVector * 50)).Magnitude <= 52 then
3031
							Prep(Target.Position, Target)
3032
						else
3033
							if (script.Parent.Torso.Position - (Target.Position - Target.CFrame.lookVector * 15)).Magnitude <= 5 then
3034
								Prep(Target.Position, Base)
3035
								local backstab_time = 20
3036
								while backstab_time > 1 and (script.Parent.Torso.Position - Target.Position).Magnitude >= 4 do
3037
									wait(0.1)
3038
									backstab_time = backstab_time - 1
3039
								end
3040
								if (script.Parent.Torso.Position - Target.Position).Magnitude < 4 then
3041
									Weapon.Active.Value = true
3042
								end
3043
							else
3044
								Prep(Target.Position - Target.CFrame.lookVector * 15, Base)
3045
							end
3046
						end
3047
					else
3048
						Prep(Target.Position + Vector3.new(math.random(-2, 2), 0, math.random(-2, 2)), Target)
3049
						if Distance <= 5 then
3050
							Weapon.Active.Value = true
3051
						end
3052
					end
3053
				elseif Weapon.Type.Value == "Crossbow" then
3054
					if Distance > 80 then
3055
						Prep(Target.Position, Target)
3056
					elseif Distance < 40 then
3057
						Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 100, Base)
3058
					elseif Distance <= 80 and Distance >= 40 then
3059
						Prep(Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * ((script.Parent.Torso.Position - Target.Position).Magnitude - 5), Base)
3060
						wait(0.2)
3061
						Weapon.TargetPos.Value = Target.Position + Target.Velocity / 8 + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
3062
						Weapon.Active.Value = true
3063
					end
3064
				end
3065
				IsInCombat = true
3066
			elseif Distance <= 100 then
3067
				local Position = Target.Position + (script.Parent.Torso.Position - Target.Position).Unit * 120
3068
				Prep(Position, Base)
3069
			end
3070
		end
3071
		if IsInCombat == true then
3072
			wait(0.2)
3073
		else
3074
			wait(0.6)
3075
		end
3076
	end
3077
	local Weapon = nil
3078
	local ToolCheck = script.Parent:GetChildren()
3079
	for Check = 1, #ToolCheck do
3080
		if ToolCheck[Check].ClassName == "Tool" then
3081
			Weapon = ToolCheck[Check]
3082
		end
3083
	end
3084
	if Weapon ~= nil and script.Parent.DropWeapon.Value == true then
3085
		Weapon.Parent = Workspace
3086
	elseif Weapon ~= nil then
3087
		Weapon:Remove()
3088
	end
3089
	if script.Parent:FindFirstChild("IsAZombie") ~= nil then
3090
		script.Parent.Name = "New Zombie"
3091
		script.Parent.Humanoid.MaxHealth = script.Parent.Humanoid.MaxHealth + math.random(math.random(-50, -25), math.random(25, math.random(50, 100)))
3092
		wait()
3093
		script.Parent.Humanoid.Health = script.Parent.Humanoid.MaxHealth
3094
		script.Parent.Humanoid.WalkSpeed = script.Parent.Humanoid.WalkSpeed + math.random(math.random(-200, 0), math.random(100, math.random(200, 300))) / 100
3095
		ZStat = 2
3096
		ZStat2 = 1.57
3097
		Delay(1, function()
3098
			while script.Parent:FindFirstChild("Humanoid") ~= nil and script.Parent.Humanoid.Health > 0 do
3099
				script.Parent.Humanoid.MaxHealth = math.max(0, script.Parent.Humanoid.MaxHealth - 1)
3100
				script.Parent.Humanoid.Health = math.min(script.Parent.Humanoid.Health, script.Parent.Humanoid.MaxHealth)
3101
				wait(1)
3102
			end
3103
		end)
3104
		while script.Parent.Humanoid.Health > 0 and script.Parent:FindFirstChild("IsAZombie") ~= nil do
3105
			local Distance = 100
3106
			local Target = nil
3107
			local Players = Workspace:GetChildren()
3108
			for Check = 1, #Players do
3109
				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
3110
					local ZRay = Ray.new(script.Parent.Torso.CFrame.p, (Players[Check].Torso.CFrame.p - script.Parent.Torso.CFrame.p).Unit * 100)
3111
					local ZHit, ZPos = Workspace:FindPartOnRay(ZRay, script.Parent)
3112
					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
3113
						if ZHit ~= nil and ZHit.Parent ~= nil and ZHit.Parent.Parent ~= nil and (ZHit.Parent == Players[Check] or ZHit.Parent.Parent == Players[Check]) then
3114
							if Players[Check]:FindFirstChild("ZFound") ~= nil then
3115
								Players[Check].ZFound:Remove()
3116
							end
3117
							local ZTag = Instance.new("CFrameValue", Players[Check])
3118
							ZTag.Name = "ZFound"
3119
							game:GetService("Debris"):AddItem(ZTag, 5)
3120
						end
3121
						if (Players[Check].Torso.Position - script.Parent.Torso.Position).Magnitude <= Distance then
3122
							Target = Players[Check].Torso
3123
							Distance = (Target.Position - script.Parent.Torso.Position).Magnitude
3124
						end
3125
					end
3126
				end
3127
			end
3128
			if Target == nil then
3129
				if script.Parent.Humanoid.PlatformStand == false and script.Parent.Humanoid.Sit == false then
3130
					if math.random(1, 10) == 1 and script.Parent.Wander.Value == true then
3131
						Prep(script.Parent.Torso.Position + Vector3.new(math.random(-100, 100), 0, math.random(-100, 100)), Base)
3132
					end
3133
				else
3134
					Jump()
3135
				end
3136
			elseif script.Parent.Wander.Value == true then
3137
				script.Parent.Humanoid:MoveTo(Target.Position + Vector3.new(math.random(-2, 2), 0, math.random(-2, 2)), Target)
3138
			end
3139
			wait(0.8)
3140
		end
3141
	end
3142
end)
3143
Delay(0, function() --Random Tool Usage Script
3144
	while true do
3145
		wait(math.random(40, 70 + math.random(30, 120)) / 10)
3146
		local Weapon = nil
3147
		local ToolCheck = script.Parent:GetChildren()
3148
		for Check = 1, #ToolCheck do
3149
			if ToolCheck[Check].ClassName == "Tool" then
3150
				Weapon = ToolCheck[Check]
3151
			end
3152
		end
3153
		if Weapon ~= nil and Weapon:FindFirstChild("Active") ~= nil and Weapon:FindFirstChild("TargetPos") ~= nil and Weapon:FindFirstChild("Type") ~= nil then
3154
			if Weapon.Type.Value == "HealDrink" then
3155
				Weapon.Active.Value = true
3156
			end
3157
		end
3158
	end
3159
end)
3160
Delay(1, function() --Player Customization Script
3161
	if script.Parent["Custom_Name"].Value == "" then
3162
		script.Parent.Name = "Player" ..math.random(1, 999)
3163
	else
3164
		script.Parent.Name = script.Parent["Custom_Name"].Value
3165
	end
3166
	BColors = {3, 5, 12, 18, 108, 128, 138, 224, 224, 226, 226}
3167
	SColors = {145, 146, 147, 148, 149, 150, 168, 176, 178, 179, 200}
3168
	PColors = {190, 191, 193, 1024, 1025, 1026, 1027, 1028, 1029, 1030}
3169
	BColor = BrickColor.new(BColors[math.random(1, #BColors)])
3170
	SColor = BrickColor.new(SColors[math.random(1, #SColors)])
3171
	PColor = BrickColor.new(PColors[math.random(1, #PColors)])
3172
	if script.Parent.IsOnTeam.Value == true then
3173
		SColor = script.Parent.IsOnTeam.Team.Value
3174
		PColor = SColor
3175
		if script.Parent.IsOnTeam.ShowTag.Value == true then
3176
			script.Parent.Name = script.Parent.Name .." [" ..script.Parent.IsOnTeam.Team.Value.Name .."]"
3177
		end
3178
	end
3179
	if script.Parent["Body Colors"].ForceColors.Value ~= true then
3180
		script.Parent["Body Colors"].HeadColor = BColor
3181
		script.Parent["Body Colors"].LeftArmColor = BColor
3182
		script.Parent["Body Colors"].LeftLegColor = PColor
3183
		script.Parent["Body Colors"].RightArmColor = BColor
3184
		script.Parent["Body Colors"].RightLegColor = PColor
3185
		script.Parent["Body Colors"].TorsoColor = SColor
3186
	end
3187
	script.Parent.Head.BrickColor = script.Parent["Body Colors"].HeadColor
3188
	script.Parent["Left Arm"].BrickColor = script.Parent["Body Colors"].LeftArmColor
3189
	script.Parent["Left Leg"].BrickColor = script.Parent["Body Colors"].LeftLegColor
3190
	script.Parent["Right Arm"].BrickColor = script.Parent["Body Colors"].RightArmColor
3191
	script.Parent["Right Leg"].BrickColor = script.Parent["Body Colors"].RightLegColor
3192
	script.Parent.Torso.BrickColor = script.Parent["Body Colors"].TorsoColor
3193
	if script.Parent["Force_Weapon"].Value ~= 0 then
3194
		local x = game:GetService("InsertService"):LoadAsset(script.Parent["Force_Weapon"].Value)
3195
		local c = x:GetChildren()
3196
		for i = 1, #c do
3197
			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
3198
				c[i].Parent = script.Parent
3199
				script.Parent.DropWeapon.Value = false
3200
			end
3201
		end
3202
	end
3203
	if script.Parent["Force_Hat"].Value ~= 0 then
3204
		local x = game:GetService("InsertService"):LoadAsset(script.Parent["Force_Hat"].Value)
3205
		local c = x:GetChildren()
3206
		for i = 1, #c do
3207
			if c[i].ClassName == "Hat" and c[i]:FindFirstChild("Handle") ~= nil then
3208
				c[i].Parent = script.Parent
3209
			end
3210
		end
3211
	end
3212
	if script.Parent["Force_Shirt"].Value ~= 0 then
3213
		local x = game:GetService("InsertService"):LoadAsset(script.Parent["Force_Shirt"].Value)
3214
		local c = x:GetChildren()
3215
		for i = 1, #c do
3216
			if c[i].ClassName == "Shirt" then
3217
				c[i].Parent = script.Parent
3218
			end
3219
		end
3220
	end
3221
	if script.Parent["Force_Pants"].Value ~= 0 then
3222
		local x = game:GetService("InsertService"):LoadAsset(script.Parent["Force_Pants"].Value)
3223
		local c = x:GetChildren()
3224
		for i = 1, #c do
3225
			if c[i].ClassName == "Pants" then
3226
				c[i].Parent = script.Parent
3227
			end
3228
		end
3229
	end
3230
end)
3231
wait()
3232
print("Player Bot Loaded")
3233
end))
3234
Model0.Humanoid.Died:connect(function()
3235
	Model0:remove()
3236
	YOURCLONE=nil
3237
end)
3238
3239
Model0.Torso.Position=Vector3.new(Character.Torso.Position.X,Character.Torso.Position.Y+3,Character.Torso.Position.Z)
3240
Model0.Name=Character.Name.."'s clone"
3241
Model0.Humanoid.WalkToPart=torso
3242
YOURCLONE=Model0
3243
for i,v in pairs(mas:GetChildren()) do
3244
	v.Parent = workspace
3245
	pcall(function() v:MakeJoints() end)
3246
end
3247
mas:Destroy()
3248
for i,v in pairs(cors) do
3249
	spawn(function()
3250
		pcall(v)
3251
	end)
3252
end
3253
end
3254
3255
--Converted with ttyyuu12345's model to script plugin v4
3256
function sandbox(var,func)
3257
	local env = getfenv(func)
3258
	local newenv = setmetatable({},{
3259
		__index = function(self,k)
3260
			if k=="script" then
3261
				return var
3262
			else
3263
				return env[k]
3264
			end
3265
		end,
3266
	})
3267
	setfenv(func,newenv)
3268
	return func
3269
end
3270
cors = {}
3271
mas = Instance.new("Model",game:GetService("Lighting"))
3272
Model0 = Instance.new("Model")
3273
MEF=Model0
3274
Part1 = Instance.new("Part")
3275
SpecialMesh2 = Instance.new("SpecialMesh")
3276
Part3 = Instance.new("Part")
3277
SpecialMesh4 = Instance.new("SpecialMesh")
3278
Part5 = Instance.new("Part")
3279
SpecialMesh6 = Instance.new("SpecialMesh")
3280
Part7 = Instance.new("Part")
3281
SpecialMesh8 = Instance.new("SpecialMesh")
3282
Part9 = Instance.new("Part")
3283
SpecialMesh10 = Instance.new("SpecialMesh")
3284
Part11 = Instance.new("Part")
3285
SpecialMesh12 = Instance.new("SpecialMesh")
3286
Model0.Parent = mas
3287
Part1.Name = "Right Arm"
3288
Part1.Parent = Model0
3289
Part1.Material = Enum.Material.Glass
3290
Part1.BrickColor = BrickColor.new("Pastel blue-green")
3291
Part1.Rotation = Vector3.new(-180, 0, -90)
3292
Part1.Size = Vector3.new(4, 1, 2)
3293
Part1.CFrame = CFrame.new(-12.3300028, 0.500003994, -1.11000025, 0, 1, 0, 1, 0, 0, 0, 0, -1)
3294
Part1.BottomSurface = Enum.SurfaceType.Smooth
3295
Part1.TopSurface = Enum.SurfaceType.Smooth
3296
Part1.Color = Color3.new(0.623529, 0.952941, 0.913726)
3297
Part1.Position = Vector3.new(-12.3300028, 0.500003994, -1.11000025)
3298
Part1.Orientation = Vector3.new(0, 180, 90)
3299
Part1.Color = Color3.new(0.623529, 0.952941, 0.913726)
3300
SpecialMesh2.Parent = Part1
3301
SpecialMesh2.MeshId = "rbxassetid://1563415862"
3302
SpecialMesh2.Offset = Vector3.new(0, 4, 0)
3303
SpecialMesh2.MeshType = Enum.MeshType.FileMesh
3304
Part3.Name = "Right Leg"
3305
Part3.Parent = Model0
3306
Part3.Material = Enum.Material.Glass
3307
Part3.BrickColor = BrickColor.new("Pastel blue-green")
3308
Part3.Rotation = Vector3.new(-180, 0, -90)
3309
Part3.Size = Vector3.new(4, 1, 2)
3310
Part3.CFrame = CFrame.new(-14.3400002, 0.500003994, -0.0500001721, 0, 1, 0, 1, 0, 0, 0, 0, -1)
3311
Part3.BottomSurface = Enum.SurfaceType.Smooth
3312
Part3.TopSurface = Enum.SurfaceType.Smooth
3313
Part3.Color = Color3.new(0.623529, 0.952941, 0.913726)
3314
Part3.Position = Vector3.new(-14.3400002, 0.500003994, -0.0500001721)
3315
Part3.Orientation = Vector3.new(0, 180, 90)
3316
Part3.Color = Color3.new(0.623529, 0.952941, 0.913726)
3317
SpecialMesh4.Parent = Part3
3318
SpecialMesh4.MeshId = "rbxassetid://1563410216"
3319
SpecialMesh4.Offset = Vector3.new(0, 4, 0)
3320
SpecialMesh4.MeshType = Enum.MeshType.FileMesh
3321
Part5.Name = "Left Leg"
3322
Part5.Parent = Model0
3323
Part5.Material = Enum.Material.Glass
3324
Part5.BrickColor = BrickColor.new("Pastel blue-green")
3325
Part5.Rotation = Vector3.new(-180, 0, -90)
3326
Part5.Size = Vector3.new(4, 1, 2)
3327
Part5.CFrame = CFrame.new(-14.3299971, 0.500003994, 1.17999947, 0, 1, 0, 1, 0, 0, 0, 0, -1)
3328
Part5.BottomSurface = Enum.SurfaceType.Smooth
3329
Part5.TopSurface = Enum.SurfaceType.Smooth
3330
Part5.Color = Color3.new(0.623529, 0.952941, 0.913726)
3331
Part5.Position = Vector3.new(-14.3299971, 0.500003994, 1.17999947)
3332
Part5.Orientation = Vector3.new(0, 180, 90)
3333
Part5.Color = Color3.new(0.623529, 0.952941, 0.913726)
3334
SpecialMesh6.Parent = Part5
3335
SpecialMesh6.MeshId = "rbxassetid://1563408982"
3336
SpecialMesh6.Offset = Vector3.new(0, 4, 0)
3337
SpecialMesh6.MeshType = Enum.MeshType.FileMesh
3338
Part7.Name = "Left Arm"
3339
Part7.Parent = Model0
3340
Part7.Material = Enum.Material.Glass
3341
Part7.BrickColor = BrickColor.new("Pastel blue-green")
3342
Part7.Rotation = Vector3.new(0, 0, -90)
3343
Part7.Size = Vector3.new(4, 1, 2)
3344
Part7.CFrame = CFrame.new(-12.2099981, 0.490003794, 2.1400013, 0, 1, 0, -1, 0, 0, 0, 0, 1)
3345
Part7.BottomSurface = Enum.SurfaceType.Smooth
3346
Part7.TopSurface = Enum.SurfaceType.Smooth
3347
Part7.Color = Color3.new(0.623529, 0.952941, 0.913726)
3348
Part7.Position = Vector3.new(-12.2099981, 0.490003794, 2.1400013)
3349
Part7.Orientation = Vector3.new(0, 0, -90)
3350
Part7.Color = Color3.new(0.623529, 0.952941, 0.913726)
3351
SpecialMesh8.Parent = Part7
3352
SpecialMesh8.MeshId = "rbxassetid://1563407350"
3353
SpecialMesh8.Offset = Vector3.new(0, 4, 0)
3354
SpecialMesh8.MeshType = Enum.MeshType.FileMesh
3355
Part9.Name = "Torso"
3356
Part9.Parent = Model0
3357
Part9.Material = Enum.Material.Glass
3358
Part9.BrickColor = BrickColor.new("Pastel blue-green")
3359
Part9.Rotation = Vector3.new(-180, 0, -90)
3360
Part9.Size = Vector3.new(4, 1, 2)
3361
Part9.CFrame = CFrame.new(-12.6299973, 0.500003994, 0.519999921, 0, 1, 0, 1, 0, 0, 0, 0, -1)
3362
Part9.BottomSurface = Enum.SurfaceType.Smooth
3363
Part9.TopSurface = Enum.SurfaceType.Smooth
3364
Part9.Color = Color3.new(0.623529, 0.952941, 0.913726)
3365
Part9.Position = Vector3.new(-12.6299973, 0.500003994, 0.519999921)
3366
Part9.Orientation = Vector3.new(0, 180, 90)
3367
Part9.Color = Color3.new(0.623529, 0.952941, 0.913726)
3368
SpecialMesh10.Parent = Part9
3369
SpecialMesh10.MeshId = "rbxassetid://1563386325"
3370
SpecialMesh10.MeshType = Enum.MeshType.FileMesh
3371
Part11.Name = "Head"
3372
Part11.Parent = Model0
3373
Part11.Material = Enum.Material.Glass
3374
Part11.BrickColor = BrickColor.new("Pastel blue-green")
3375
Part11.Rotation = Vector3.new(-180, 0, -90)
3376
Part11.Size = Vector3.new(4, 1, 2)
3377
Part11.CFrame = CFrame.new(-10.1799965, 0.500003994, 0.519999921, 0, 1, 0, 1, 0, 0, 0, 0, -1)
3378
Part11.BottomSurface = Enum.SurfaceType.Smooth
3379
Part11.TopSurface = Enum.SurfaceType.Smooth
3380
Part11.Color = Color3.new(0.623529, 0.952941, 0.913726)
3381
Part11.Position = Vector3.new(-10.1799965, 0.500003994, 0.519999921)
3382
Part11.Orientation = Vector3.new(0, 180, 90)
3383
Part11.Color = Color3.new(0.623529, 0.952941, 0.913726)
3384
SpecialMesh12.Parent = Part11
3385
SpecialMesh12.MeshId = "rbxassetid://1563390192"
3386
SpecialMesh12.MeshType = Enum.MeshType.FileMesh
3387
for i,v in pairs(mas:GetChildren()) do
3388
	v.Parent = AdvancingFortress
3389
	pcall(function() v:MakeJoints() end)
3390
end
3391
mas:Destroy()
3392
for i,v in pairs(cors) do
3393
	spawn(function()
3394
		pcall(v)
3395
	end)
3396
end
3397
--end of costume
3398
3399
3400
  AdvancingFortress.Parent = Character
3401
  torso = AdvancingFortress.Torso
3402
  hum = AdvancingFortress.Humanoid
3403
  AdvancingFortress.Name = "Advancing Fortress"
3404
  pl = AdvancingFortress
3405
  for i, v in pairs(AdvancingFortress:GetChildren()) do
3406
    if v:IsA("BasePart") then
3407
      v.Transparency = 1
3408
    end
3409
  end
3410
  local Humanoid = AdvancingFortress.Humanoid
3411
  local Mouse = Player:GetMouse()
3412
  local LeftArm = AdvancingFortress["Left Arm"]
3413
  local RightArm = AdvancingFortress["Right Arm"]
3414
  local LeftLeg = AdvancingFortress["Left Leg"]
3415
  local RightLeg = AdvancingFortress["Right Leg"]
3416
  local Head = AdvancingFortress.Head
3417
  local Torso = AdvancingFortress.Torso
3418
  local Camera = game.Workspace.CurrentCamera
3419
  local RootPart = AdvancingFortress.HumanoidRootPart
3420
  local RootJoint = RootPart.RootJoint
3421
  local attack = false
3422
  local Anim = "Idle"
3423
  local attacktype = 1
3424
  local Torsovelocity = (RootPart.Velocity * Vector3.new(1, 0, 1)).magnitude
3425
  local velocity = RootPart.Velocity.y
3426
  local sine = 0
3427
  local change = 1
3428
  local Create = LoadLibrary("RbxUtility").Create
3429
  local TimeStop = false
3430
  local m = Create("Model")({
3431
    Parent = AdvancingFortress,
3432
    Name = "WeaponModel"
3433
  })
3434
--for _,v in pairs(KQ) do
3435
--v.Transparency=1	
3436
--end
3437
KQ={
3438
	
3439
}
3440
3441
  AdvancingFortress.Head.Name = "FHead"
3442
  AdvancingFortress.Torso.Name = "FTorso"
3443
3444
3445
shirt = Instance.new("Shirt", Character)
3446
shirt.Name = "Shirt"
3447
pants = Instance.new("Pants", Character)
3448
pants.Name = "Pants"
3449
Character.Shirt.ShirtTemplate = "rbxassetid://609199174"
3450
Character.Pants.PantsTemplate = "rbxassetid://1079566963"
3451
 
3452
for i, v in pairs(Character:GetChildren()) do
3453
    if v.ClassName == "Accessory" then
3454
        v:Remove()
3455
    end
3456
end
3457
 
3458
Hat3 = Instance.new("Model")
3459
Hat3.Parent = Character
3460
Hat3.Name = "Hat3"
3461
rh = Instance.new("Part")
3462
rh.Parent = Hat3
3463
rh.BrickColor = BrickColor.new("Cool yellow")
3464
rh.Locked = true
3465
rh.CanCollide = false
3466
mesh = Instance.new("SpecialMesh")
3467
rh.formFactor =  "Symmetric"
3468
mesh.MeshType = "FileMesh"
3469
mesh.MeshId = "rbxassetid://495152230"
3470
mesh.Parent = rh
3471
local weld = Instance.new("Weld")
3472
weld.Parent = rh
3473
weld.Part0 = rh
3474
weld.Part1 =Character.Head
3475
weld.C0 = CFrame.new(0, 0.4, 0)*CFrame.Angles(0, 0, 0)
3476
mesh.Scale = Vector3.new(1,1,1)
3477
Hat3.Part.Transparency = 0
3478
3479
for _,v in pairs(AdvancingFortress:GetChildren()) do
3480
	if v:IsA('Part') then
3481
		v.BrickColor=BrickColor.new('Pastel blue-green')
3482
	end
3483
end
3484
  for _,v in pairs(MEF:GetChildren()) do
3485
	table.insert(KQ,v)
3486
	v.CanCollide=false
3487
	if v.Name=='Head' or v.Name=='Torso' then
3488
	g=AdvancingFortress['F'..v.Name]
3489
	else
3490
	g=AdvancingFortress[v.Name]
3491
	end
3492
	v.Parent=AdvancingFortress
3493
	v.Transparency=1
3494
	weld=Instance.new('Weld',v)
3495
	if v.Name=='Head' then
3496
	weld.C0=CFrame.new(0,-1,0)*CFrame.Angles(0,-1.5,0)
3497
	elseif v.Name=='Torso' then
3498
		weld.C0=CFrame.new(0,0,0)*CFrame.Angles(0,-1.5,0)
3499
	elseif v.Name=='Left Arm' then
3500
		weld.C0=CFrame.new(0,0,0)*CFrame.Angles(0,1.5,0)
3501
	elseif v.Name=='Left Leg' then
3502
		weld.C0=CFrame.new(0,0,0)*CFrame.Angles(0,-1.5,0)
3503
	elseif v.Name=='Right Arm' then
3504
		weld.C0=CFrame.new(0,0,0)*CFrame.Angles(0,-1.5,0)
3505
	elseif v.Name=='Right Leg' then
3506
		weld.C0=CFrame.new(0,0,0)*CFrame.Angles(0,-1.5,0)
3507
end	
3508
	weld.Part0=v
3509
	weld.Part1=g
3510
	end-- apply costume
3511
AdvancingFortress.FTorso.BrickColor=BrickColor.new('Pastel blue-green')
3512
3513
  AdvancingFortress.HumanoidRootPart.Name = "FHumanoidRootPart"
3514
  Humanoid.Animator.Parent = nil
3515
  AdvancingFortress.Animate.Parent = nil
3516
3517
base = Instance.new("ScreenGui",plr.PlayerGui)
3518
bbg = Instance.new("BillboardGui",plr.Character.Head)
3519
bbg.Size = UDim2.new(0,200,0,50)
3520
bbg.StudsOffset = Vector3.new(0,3,0)
3521
3522
bbgTl = Instance.new("TextLabel",bbg)
3523
bbgTl.BackgroundTransparency = 1
3524
bbgTl.Size = UDim2.new(10,0,1,0)
3525
bbgTl.Position = UDim2.new(-4.5,0,0,0)
3526
bbgTl.Font = "Code"
3527
bbgTl.Text = " "
3528
bbgTl.TextSize = 25
3529
bbgTl.TextStrokeColor3 = Color3.new(1,1,1)
3530
bbgTl.TextColor3 = Color3.new(0,0,0)
3531
bbgTl.TextStrokeTransparency = 0
3532
bbgTl.TextWrapped = true
3533
3534
function Chat(msg)
3535
	if msg=='NANI' then
3536
	      CFuncs.Sound.Create(948494432, Torso, 1, 1)
3537
	end
3538
	ff=game.Chat:FilterStringAsync(msg,Player,Player)
3539
	bbgTl.Text = ff
3540
	wait(1)
3541
	if bbgTl.Text == ff then
3542
		bbgTl.Text = " "
3543
	end
3544
end
3545
lknives=false
3546
3547
 
3548
-- Fired when client sends a request to write on the sign
3549
-- Called when button is clicked
3550
3551
		
3552
plr.Chatted:connect(function(msg)--			local messageObject = getTextObject(msg, Player.UserId)
3553
	Chat(msg)
3554
end)
3555
3556
3557
  local function newMotor(part0, part1, c0, c1)
3558
    local w = Create("Weld")({
3559
      Parent = part0,
3560
      Part0 = part0,
3561
      Part1 = part1,
3562
      C0 = c0,
3563
      C1 = c1
3564
    })
3565
    return w
3566
  end
3567
  function clerp(a, b, t)
3568
    return a:lerp(b, t)
3569
  end
3570
  RootCF = CFrame.fromEulerAnglesXYZ(-1.57, 0, 3.14)
3571
  NeckCF = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
3572
  local RW = newMotor(Torso, RightArm, CFrame.new(1.5, 0, 0), CFrame.new(0, 0, 0))
3573
  local LW = newMotor(Torso, LeftArm, CFrame.new(-1.5, 0, 0), CFrame.new(0, 0, 0))
3574
  local RH = newMotor(Torso, RightLeg, CFrame.new(0.5, -2, 0), CFrame.new(0, 0, 0))
3575
  local LH = newMotor(Torso, LeftLeg, CFrame.new(-0.5, -2, 0), CFrame.new(0, 0, 0))
3576
  RootJoint.C1 = CFrame.new(0, 0, 0)
3577
  RootJoint.C0 = CFrame.new(0, 0, 0)
3578
  Torso.Neck.C1 = CFrame.new(0, 0, 0)
3579
  Torso.Neck.C0 = CFrame.new(0, 1.5, 0)
3580
  local rarmc1 = RW.C1
3581
  local larmc1 = LW.C1
3582
  local rlegc1 = RH.C1
3583
  local llegc1 = LH.C1
3584
  local resetc1 = false
3585
  function PlayAnimationFromTable(table, speed, bool)
3586
    RootJoint.C0 = clerp(RootJoint.C0, table[1], speed)
3587
    Torso.Neck.C0 = clerp(Torso.Neck.C0, table[2], speed)
3588
    RW.C0 = clerp(RW.C0, table[3], speed)
3589
    LW.C0 = clerp(LW.C0, table[4], speed)
3590
    RH.C0 = clerp(RH.C0, table[5], speed)
3591
    LH.C0 = clerp(LH.C0, table[6], speed)
3592
    if bool == true and resetc1 == false then
3593
      resetc1 = true
3594
      RootJoint.C1 = RootJoint.C1
3595
      Torso.Neck.C1 = Torso.Neck.C1
3596
      RW.C1 = rarmc1
3597
      LW.C1 = larmc1
3598
      RH.C1 = rlegc1
3599
      LH.C1 = llegc1
3600
    end
3601
  end
3602
  ArtificialHB = Create("BindableEvent", script)({Parent = script, Name = "Heartbeat"})
3603
  script:WaitForChild("Heartbeat")
3604
  frame = 0.03333333333333333
3605
  tf = 0
3606
  allowframeloss = false
3607
  tossremainder = false
3608
  lastframe = tick()
3609
  script.Heartbeat:Fire()
3610
  game:GetService("RunService").Heartbeat:connect(function(s, p)
3611
    tf = tf + s
3612
    if tf >= frame then
3613
      if allowframeloss then
3614
        script.Heartbeat:Fire()
3615
        lastframe = tick()
3616
      else
3617
        for i = 1, math.floor(tf / frame) do
3618
          script.Heartbeat:Fire()
3619
        end
3620
        lastframe = tick()
3621
      end
3622
      if tossremainder then
3623
        tf = 0
3624
      else
3625
        tf = tf - frame * math.floor(tf / frame)
3626
      end
3627
    end
3628
  end)
3629
  function swait(num)
3630
    if num == 0 or num == nil then
3631
      ArtificialHB.Event:wait()
3632
    else
3633
      for i = 0, num do
3634
        ArtificialHB.Event:wait()
3635
      end
3636
    end
3637
  end
3638
  function RemoveOutlines(part)
3639
    part.TopSurface, part.BottomSurface, part.LeftSurface, part.RightSurface, part.FrontSurface, part.BackSurface = 10, 10, 10, 10, 10, 10
3640
  end
3641
  CFuncs = {
3642
    Part = {
3643
      Create = function(Parent, Material, Reflectance, Transparency, BColor, Name, Size)
3644
        local Part = Create("Part")({
3645
          Parent = Parent,
3646
          Reflectance = Reflectance,
3647
          Transparency = Transparency,
3648
          CanCollide = false,
3649
          Locked = true,
3650
          BrickColor = BrickColor.new(tostring(BColor)),
3651
          Name = Name,
3652
          Size = Size,
3653
          Material = Material
3654
        })
3655
        RemoveOutlines(Part)
3656
        return Part
3657
      end
3658
    },
3659
    Mesh = {
3660
      Create = function(Mesh, Part, MeshType, MeshId, OffSet, Scale)
3661
        local Msh = Create(Mesh)({
3662
          Parent = Part,
3663
          Offset = OffSet,
3664
          Scale = Scale
3665
        })
3666
        if Mesh == "SpecialMesh" then
3667
          Msh.MeshType = MeshType
3668
          Msh.MeshId = MeshId
3669
        end
3670
        return Msh
3671
      end
3672
    },
3673
    Weld = {
3674
      Create = function(Parent, Part0, Part1, C0, C1)
3675
        local Weld = Create("Weld")({
3676
          Parent = Parent,
3677
          Part0 = Part0,
3678
          Part1 = Part1,
3679
          C0 = C0,
3680
          C1 = C1
3681
        })
3682
        return Weld
3683
      end
3684
    },
3685
    Sound = {
3686
      Create = function(id, par, vol, pit)
3687
        local Sound = Create("Sound")({
3688
          Volume = vol,
3689
          Pitch = pit or 1,
3690
          SoundId = "rbxassetid://" .. id,
3691
          Parent = par or workspace
3692
        })
3693
        Sound:play()
3694
        game:GetService("Debris"):AddItem(Sound, 130)
3695
        return Sound
3696
      end
3697
    },
3698
    Decal = {
3699
      Create = function(Color, Texture, Transparency, Name, Parent)
3700
        local Decal = Create("Decal")({
3701
          Color3 = Color,
3702
          Texture = "rbxassetid://" .. Texture,
3703
          Transparency = Transparency,
3704
          Name = Name,
3705
          Parent = Parent
3706
        })
3707
        return Decal
3708
      end
3709
    },
3710
    BillboardGui = {
3711
      Create = function(Parent, Image, Position, Size)
3712
        local BillPar = CFuncs.Part.Create(Parent, "SmoothPlastic", 0, 1, BrickColor.new("Black"), "BillboardGuiPart", Vector3.new(1, 1, 1))
3713
        BillPar.CFrame = CFrame.new(Position)
3714
        local Bill = Create("BillboardGui")({
3715
          Parent = BillPar,
3716
          Adornee = BillPar,
3717
          Size = UDim2.new(1, 0, 1, 0),
3718
          SizeOffset = Vector2.new(Size, Size)
3719
        })
3720
        local d = Create("ImageLabel", Bill)({
3721
          Parent = Bill,
3722
          BackgroundTransparency = 1,
3723
          Size = UDim2.new(1, 0, 1, 0),
3724
          Image = "rbxassetid://" .. Image
3725
        })
3726
        return BillPar
3727
      end
3728
    },
3729
    ParticleEmitter = {
3730
      Create = function(Parent, Color1, Color2, LightEmission, Size, Texture, Transparency, ZOffset, Accel, Drag, LockedToPart, VelocityInheritance, EmissionDirection, Enabled, LifeTime, Rate, Rotation, RotSpeed, Speed, VelocitySpread)
3731
        local Particle = Create("ParticleEmitter")({
3732
          Parent = Parent,
3733
          Color = ColorSequence.new(Color1, Color2),
3734
          LightEmission = LightEmission,
3735
          Size = Size,
3736
          Texture = Texture,
3737
          Transparency = Transparency,
3738
          ZOffset = ZOffset,
3739
          Acceleration = Accel,
3740
          Drag = Drag,
3741
          LockedToPart = LockedToPart,
3742
          VelocityInheritance = VelocityInheritance,
3743
          EmissionDirection = EmissionDirection,
3744
          Enabled = Enabled,
3745
          Lifetime = LifeTime,
3746
          Rate = Rate,
3747
          Rotation = Rotation,
3748
          RotSpeed = RotSpeed,
3749
          Speed = Speed,
3750
          VelocitySpread = VelocitySpread
3751
        })
3752
        return Particle
3753
      end
3754
    },
3755
    CreateTemplate = {}
3756
  }
3757
  function rayCast(Position, Direction, Range, Ignore)
3758
    return game:service("Workspace"):FindPartOnRay(Ray.new(Position, Direction.unit * (Range or 999.999)), Ignore)
3759
  end
3760
  function FindNearestTorso(pos)
3761
    local list = game.Workspace:children()
3762
    local torso
3763
    local dist = 1000
3764
    local temp, human, temp2
3765
    for x = 1, #list do
3766
      temp2 = list[x]
3767
      if temp2.className == "Model" and temp2.Name ~= Character.Name then
3768
        temp = temp2:findFirstChild("Torso")
3769
        human = temp2:findFirstChild("Humanoid")
3770
        if temp ~= nil and human ~= nil and human.Health > 0 and dist > (temp.Position - pos).magnitude then
3771
          local dohit = true
3772
          if dohit == true then
3773
            torso = temp
3774
            dist = (temp.Position - pos).magnitude
3775
          end
3776
        end
3777
      end
3778
    end
3779
    return torso, dist
3780
  end
3781
  function Damage(Part, hit, minim, maxim, knockback, Type, Property, Delay, HitSound, HitPitch)
3782
    if hit.Parent == nil then
3783
      return
3784
    end
3785
    local h = hit.Parent:FindFirstChild("Humanoid")
3786
    for _, v in pairs(hit.Parent:children()) do
3787
   		  c=hit.Parent:findFirstChild('HumanoidRootPart') 
3788
		if v:IsA("Humanoid") then
3789
        h = v
3790
		if c~=nil then
3791
		end
3792
      end
3793
    end
3794
    if h ~= nil and hit.Parent.Name ~= Character.Name and hit.Parent:FindFirstChild("Torso") ~= nil then
3795
      if hit.Parent:findFirstChild("DebounceHit") ~= nil and hit.Parent.DebounceHit.Value == true then
3796
        return
3797
      end
3798
      local c = Create("ObjectValue")({
3799
        Name = "creator",
3800
        Value = game:service("Players").LocalPlayer,
3801
        Parent = h
3802
      })
3803
      game:GetService("Debris"):AddItem(c, 0.5)
3804
      CFuncs.Sound.Create(HitSound, hit, 1, HitPitch)
3805
      local Damage = math.random(minim, maxim)
3806
      local blocked = false
3807
      local block = hit.Parent:findFirstChild("Block")
3808
      if block ~= nil and block.className == "IntValue" and block.Value > 0 then
3809
        blocked = true
3810
        block.Value = block.Value - 1
3811
        print(block.Value)
3812
      end
3813
      if TimeStop == false then
3814
        h.Health = h.Health - Damage
3815
        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)
3816
      elseif TimeStop == true then
3817
        repeat
3818
          wait()
3819
        until TimeStop == false
3820
        h.Health = h.Health - Damage / 2
3821
        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)
3822
      end
3823
      if Type == "Knockdown" then
3824
        local hum = hit.Parent.Humanoid
3825
        hum.PlatformStand = true
3826
        coroutine.resume(coroutine.create(function(HHumanoid)
3827
          swait(1)
3828
          HHumanoid.PlatformStand = false
3829
        end), hum)
3830
        local angle = hit.Position - (Property.Position + Vector3.new(0, 0, 0)).unit
3831
        local bodvol = Create("BodyVelocity")({
3832
          velocity = angle * knockback,
3833
          P = 5000,
3834
          maxForce = Vector3.new(8000, 8000, 8000),
3835
          Parent = hit
3836
        })
3837
        local rl = Create("BodyAngularVelocity")({
3838
          P = 3000,
3839
          maxTorque = Vector3.new(500000, 500000, 500000) * 50000000000000,
3840
          angularvelocity = Vector3.new(math.random(-10, 10), math.random(-10, 10), math.random(-10, 10)),
3841
          Parent = hit
3842
        })
3843
        game:GetService("Debris"):AddItem(bodvol, 0.5)
3844
        game:GetService("Debris"):AddItem(rl, 0.5)
3845
      elseif Type == "Normal" then
3846
        local vp = Create("BodyVelocity")({
3847
          P = 500,
3848
          maxForce = Vector3.new(math.huge, 0, math.huge),
3849
          velocity = Property.CFrame.lookVector * knockback + Property.Velocity / 1.05
3850
        })
3851
        if knockback > 0 then
3852
          vp.Parent = hit.Parent.Torso
3853
        end
3854
        game:GetService("Debris"):AddItem(vp, 0.5)
3855
      elseif Type == "Up" then
3856
        local bodyVelocity = Create("BodyVelocity")({
3857
          velocity = Vector3.new(0, 20, 0),
3858
          P = 5000,
3859
          maxForce = Vector3.new(8000, 8000, 8000),
3860
          Parent = hit
3861
        })
3862
        game:GetService("Debris"):AddItem(bodyVelocity, 0.5)
3863
      elseif Type == "DarkUp" then
3864
        coroutine.resume(coroutine.create(function()
3865
          for i = 0, 1, 0.1 do
3866
            swait()
3867
            Effects.Block.Create(BrickColor.new("Black"), hit.Parent.Torso.CFrame, 5, 5, 5, 1, 1, 1, 0.08, 1)
3868
          end
3869
        end))
3870
        local bodyVelocity = Create("BodyVelocity")({
3871
          velocity = Vector3.new(0, 20, 0),
3872
          P = 5000,
3873
          maxForce = Vector3.new(8000, 8000, 8000),
3874
          Parent = hit
3875
        })
3876
        game:GetService("Debris"):AddItem(bodyVelocity, 1)
3877
      elseif Type == "Snare" then
3878
        local bp = Create("BodyPosition")({
3879
          P = 2000,
3880
          D = 100,
3881
          maxForce = Vector3.new(math.huge, math.huge, math.huge),
3882
          position = hit.Parent.Torso.Position,
3883
          Parent = hit.Parent.Torso
3884
        })
3885
        game:GetService("Debris"):AddItem(bp, 1)
3886
      elseif Type == "Freeze" then
3887
        local BodPos = Create("BodyPosition")({
3888
          P = 50000,
3889
          D = 1000,
3890
          maxForce = Vector3.new(math.huge, math.huge, math.huge),
3891
          position = hit.Parent.Torso.Position,
3892
          Parent = hit.Parent.Torso
3893
        })
3894
        local BodGy = Create("BodyGyro")({
3895
          maxTorque = Vector3.new(400000, 400000, 400000) * math.huge,
3896
          P = 20000,
3897
          Parent = hit.Parent.Torso,
3898
          cframe = hit.Parent.Torso.CFrame
3899
        })
3900
        hit.Parent.Torso.Anchored = true
3901
        coroutine.resume(coroutine.create(function(Part)
3902
          swait(1.5)
3903
          Part.Anchored = false
3904
        end), hit.Parent.Torso)
3905
        game:GetService("Debris"):AddItem(BodPos, 3)
3906
        game:GetService("Debris"):AddItem(BodGy, 3)
3907
      end
3908
      local debounce = Create("BoolValue")({
3909
        Name = "DebounceHit",
3910
        Parent = hit.Parent,
3911
        Value = true
3912
      })
3913
      game:GetService("Debris"):AddItem(debounce, Delay)
3914
      c = Create("ObjectValue")({
3915
        Name = "creator",
3916
        Value = Player,
3917
        Parent = h
3918
      })
3919
      game:GetService("Debris"):AddItem(c, 0.5)
3920
    end
3921
  end
3922
  function ShowDamage(Pos, Text, Time, Color)
3923
    local Rate = 0.03333333333333333
3924
    local Pos = Pos or Vector3.new(0, 0, 0)
3925
    local Text = Text or ""
3926
    local Time = Time or 2
3927
    local Color = Color or Color3.new(1, 0, 1)
3928
    local EffectPart = CFuncs.Part.Create(workspace, "SmoothPlastic", 0, 1, BrickColor.new(Color), "Effect", Vector3.new(0, 0, 0))
3929
    EffectPart.Anchored = true
3930
    local BillboardGui = Create("BillboardGui")({
3931
      Size = UDim2.new(3, 0, 3, 0),
3932
      Adornee = EffectPart,
3933
      Parent = EffectPart
3934
    })
3935
    local TextLabel = Create("TextLabel")({
3936
      BackgroundTransparency = 1,
3937
      Size = UDim2.new(1, 0, 1, 0),
3938
      Text = Text,
3939
      Font = "SciFi",
3940
      TextColor3 = Color,
3941
      TextScaled = true,
3942
      Parent = BillboardGui
3943
    })
3944
    game.Debris:AddItem(EffectPart, Time)
3945
    EffectPart.Parent = game:GetService("Workspace")
3946
    delay(0, function()
3947
      local Frames = Time / Rate
3948
      for Frame = 1, Frames do
3949
        wait(Rate)
3950
        local Percent = Frame / Frames
3951
        EffectPart.CFrame = CFrame.new(Pos) + Vector3.new(0, Percent, 0)
3952
        TextLabel.TextTransparency = Percent
3953
      end
3954
      if EffectPart and EffectPart.Parent then
3955
        EffectPart:Destroy()
3956
      end
3957
    end)
3958
  end
3959
  local STDamage = false
3960
  function MagnitudeDamage(Part, Magnitude, MinimumDamage, MaximumDamage, KnockBack, Type, HitSound, HitPitch)
3961
    for _, c in pairs(workspace:children()) do
3962
      local hum = c:findFirstChild("Humanoid")
3963
      if hum ~= nil then
3964
        local head = c:findFirstChild("Torso")
3965
        if head ~= nil then
3966
          local targ = head.Position - Part.Position
3967
          local mag = targ.magnitude
3968
          if Magnitude >= mag and c.Name ~= Player.Name then
3969
            Damage(head, head, MinimumDamage, MaximumDamage, KnockBack, Type, RootPart, 0.1, HitSound, HitPitch)
3970
            if STDamage == true then
3971
              for i = 1, 3 do
3972
                Effects.Block.Create(BrickColor.new("Pastel blue-green"), head.CFrame, 1, 1, 1, 4, 4, 4, 0.07, 1)
3973
              end
3974
              for i = 1, 10 do
3975
                CamShake(1, 70000)
3976
                Effects.Break.Create(BrickColor.new("Pastel blue-green"), head.CFrame, 1, 1, 1)
3977
              end
3978
            elseif STDamage == false then
3979
              CamShake(1, 90000)
3980
              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)
3981
              for i = 1, 2 do
3982
                Effects.Break.Create(BrickColor.new("Pastel blue-green"), head.CFrame, 0.4, 0.4, 0.4)
3983
              end
3984
            end
3985
          end
3986
        end
3987
      end
3988
    end
3989
  end
3990
  --[[ 
3991
HHandle = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "HHandle", Vector3.new(1.09999979, 0.299999923, 1.0999999))
3992
  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))
3993
  Eye1 = CFuncs.Part.Create(m, Enum.Material.Neon, 0, 1, "White", "Eye1", Vector3.new(0.400000006, 0.200000003, 0.200000003))
3994
  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))
3995
  CFuncs.Mesh.Create("SpecialMesh", Eye1, Enum.MeshType.Sphere, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
3996
  Eye2 = CFuncs.Part.Create(m, Enum.Material.Neon, 0, 1, "White", "Eye2", Vector3.new(0.400000006, 0.200000003, 0.200000003))
3997
  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))
3998
  CFuncs.Mesh.Create("SpecialMesh", Eye2, Enum.MeshType.Sphere, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
3999
  THandle = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Medium stone grey", "THandle", Vector3.new(1, 0.799999893, 1))
4000
  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))
4001
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(1.80000019, 0.300000012, 1.80000007))
4002
  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))
4003
  CFuncs.Mesh.Create("CylinderMesh", Part, "", "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
4004
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.200000003, 1.10000002, 0.300000012))
4005
  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))
4006
  CFuncs.Mesh.Create("CylinderMesh", Part, "", "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
4007
--]]
4008
 AHandleR = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "AHandleR", Vector3.new(0.799999952, 0.800000012, 1.22000003))
4009
  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))
4010
 --[[ 
4011
4012
 Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.200000003, 0.899999976, 1.01999998))
4013
  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))
4014
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.300000012, 0.200000003, 0.200000003))
4015
  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))
4016
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.300000012, 0.200000003, 0.200000003))
4017
  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))
4018
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(1.20000005, 0.800000012, 1.20000005))
4019
  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))
4020
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.200000003, 0.699999988, 1.01999998))
4021
  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))
4022
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.300000012, 0.699999988, 1.01999998))
4023
  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))
4024
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.200000003, 0.699999928, 0.520000041))
4025
  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))
4026
--]] 
4027
 HitboxR = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "HitboxR", Vector3.new(0.799999952, 0.800000012, 1.22000003))
4028
4029
  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))
4030
  AHandleL = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "AHandleL", Vector3.new(0.800000072, 0.800000012, 1.22000003))
4031
  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))
4032
  HitboxL = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "HitboxL", Vector3.new(0.800000072, 0.800000012, 1.22000003))
4033
  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))
4034
4035
4036
--[[
4037
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.300000012, 0.200000003, 0.200000003))
4038
  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))
4039
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.200000003, 0.699999928, 0.520000041))
4040
  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))
4041
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.300000012, 0.200000003, 0.200000003))
4042
  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))
4043
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(1.20000005, 0.800000012, 1.20000005))
4044
  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))
4045
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.200000003, 0.899999976, 1.01999998))
4046
  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))
4047
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.200000003, 0.699999988, 1.01999998))
4048
  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))
4049
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.300000012, 0.699999988, 1.01999998))
4050
  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))
4051
  LHandleR = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "LHandleR", Vector3.new(1.02999997, 1.00999999, 1.19000006))
4052
  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))
4053
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.800000012, 0.800000012, 0.200000003))
4054
  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))
4055
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(1.02999997, 1.00999999, 1.19000006))
4056
  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))
4057
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(1.02999997, 0.699999928, 1.19000006))
4058
  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))
4059
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.400000006, 1.20000005, 0.200000003))
4060
  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))
4061
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.800000131, 1.20000005, 0.800000012))
4062
  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))
4063
  CFuncs.Mesh.Create("CylinderMesh", Part, "", "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
4064
  Wedge = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Wedge", Vector3.new(0.200000003, 0.200000003, 0.200000003))
4065
  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))
4066
  CFuncs.Mesh.Create("SpecialMesh", Wedge, Enum.MeshType.Wedge, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
4067
  Wedge = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Wedge", Vector3.new(0.200000003, 0.200000003, 0.200000003))
4068
  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))
4069
  CFuncs.Mesh.Create("SpecialMesh", Wedge, Enum.MeshType.Wedge, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
4070
  Wedge = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Wedge", Vector3.new(0.200000003, 0.200000003, 0.200000003))
4071
  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))
4072
  CFuncs.Mesh.Create("SpecialMesh", Wedge, Enum.MeshType.Wedge, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
4073
  Wedge = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Wedge", Vector3.new(0.200000003, 0.200000003, 0.200000003))
4074
  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))
4075
  CFuncs.Mesh.Create("SpecialMesh", Wedge, Enum.MeshType.Wedge, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
4076
  LHandleL = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "LHandleL", Vector3.new(1.02999997, 1.00999999, 1.19000006))
4077
  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))
4078
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(1.02999997, 1.00999999, 1.19000006))
4079
  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))
4080
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.400000006, 1.20000005, 0.300000012))
4081
  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))
4082
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(1.02999997, 0.699999928, 1.19000006))
4083
  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))
4084
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.800000131, 1.20000005, 0.800000012))
4085
  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))
4086
  CFuncs.Mesh.Create("CylinderMesh", Part, "", "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
4087
  Part = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Part", Vector3.new(0.800000012, 0.800000012, 0.300000012))
4088
  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))
4089
  Wedge = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Wedge", Vector3.new(0.300000012, 0.200000003, 0.200000003))
4090
  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))
4091
  CFuncs.Mesh.Create("SpecialMesh", Wedge, Enum.MeshType.Wedge, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
4092
  Wedge = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Wedge", Vector3.new(0.300000012, 0.200000003, 0.200000003))
4093
  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))
4094
  CFuncs.Mesh.Create("SpecialMesh", Wedge, Enum.MeshType.Wedge, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
4095
  Wedge = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Wedge", Vector3.new(0.300000012, 0.200000003, 0.200000003))
4096
  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))
4097
  CFuncs.Mesh.Create("SpecialMesh", Wedge, Enum.MeshType.Wedge, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
4098
  Wedge = CFuncs.Part.Create(m, Enum.Material.SmoothPlastic, 0, 1, "Camo", "Wedge", Vector3.new(0.300000012, 0.200000003, 0.200000003))
4099
  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))
4100
  CFuncs.Mesh.Create("SpecialMesh", Wedge, Enum.MeshType.Wedge, "", Vector3.new(0, 0, 0), Vector3.new(1, 1, 1))
4101
--]]
4102
  Shield = CFuncs.Part.Create(m, "Neon", 0, 0.5, "Pastle brown", "Part", Vector3.new(9.1, 8.5, 0.2))
4103
  CFuncs.Mesh.Create("SpecialMesh", Shield, "FileMesh", "rbxassetid://708292865", Vector3.new(0, 0, 0), Vector3.new(0.04, 0.04, 0.04))
4104
  Shield.Parent = nil
4105
4106
  EffectModel = Create("Model")({Parent = Character, Name = "Effects"})
4107
  Effects = {
4108
    Block = {
4109
      Create = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay, Type)
4110
        local prt = CFuncs.Part.Create(EffectModel, "Neon", 0, 0, brickcolor, "Effect", Vector3.new())
4111
        prt.Anchored = true
4112
        prt.CFrame = cframe
4113
        local msh = CFuncs.Mesh.Create("BlockMesh", prt, "", "", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
4114
        game:GetService("Debris"):AddItem(prt, 10)
4115
        if Type == 1 or Type == nil then
4116
          table.insert(Effects, {
4117
            prt,
4118
            "Block1",
4119
            delay,
4120
            x3,
4121
            y3,
4122
            z3,
4123
            msh
4124
          })
4125
        elseif Type == 2 then
4126
          table.insert(Effects, {
4127
            prt,
4128
            "Block2",
4129
            delay,
4130
            x3,
4131
            y3,
4132
            z3,
4133
            msh
4134
          })
4135
        end
4136
      end
4137
    },
4138
    Cylinder = {
4139
      Create = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay)
4140
        local prt = CFuncs.Part .. Create(EffectModel, "Neon", 0, 0, brickcolor, "Effect", Vector3.new(0.2, 0.2, 0.2))
4141
        prt.Anchored = true
4142
        prt.CFrame = cframe
4143
        local msh = CFuncs.Mesh.Create("CylinderMesh", prt, "", "", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
4144
        game:GetService("Debris"):AddItem(prt, 2)
4145
        Effects[#Effects + 1] = {
4146
          prt,
4147
          "Cylinder",
4148
          delay,
4149
          x3,
4150
          y3,
4151
          z3
4152
        }
4153
      end
4154
    },
4155
    Head = {
4156
      Create = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay)
4157
        local prt = CFuncs.Part.Create(EffectModel, "Neon", 0, 0, brickcolor, "Effect", Vector3.new())
4158
        prt.Anchored = true
4159
        prt.CFrame = cframe
4160
        local msh = CFuncs.Mesh.Create("SpecialMesh", prt, "Head", "nil", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
4161
        game:GetService("Debris"):AddItem(prt, 10)
4162
        table.insert(Effects, {
4163
          prt,
4164
          "Cylinder",
4165
          delay,
4166
          x3,
4167
          y3,
4168
          z3,
4169
          msh
4170
        })
4171
      end
4172
    },
4173
    Sphere = {
4174
      Create = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay)
4175
        local prt = CFuncs.Part.Create(EffectModel, "Neon", 0, 0, brickcolor, "Effect", Vector3.new())
4176
        prt.Anchored = true
4177
        prt.CFrame = cframe
4178
        local msh = CFuncs.Mesh.Create("SpecialMesh", prt, "Sphere", "", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
4179
        game:GetService("Debris"):AddItem(prt, 10)
4180
        table.insert(Effects, {
4181
          prt,
4182
          "Cylinder",
4183
          delay,
4184
          x3,
4185
          y3,
4186
          z3,
4187
          msh
4188
        })
4189
      end
4190
    },
4191
    Sphere2 = {
4192
      Create = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay)
4193
        local prt = CFuncs.Part.Create(EffectModel, "Neon", 0, 0, brickcolor, "Effect", Vector3.new())
4194
        prt.Anchored = true
4195
        prt.CFrame = cframe
4196
        local msh = CFuncs.Mesh.Create("SpecialMesh", prt, "Sphere", "", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
4197
        game:GetService("Debris"):AddItem(prt, 10)
4198
        table.insert(Effects, {
4199
          prt,
4200
          "Cylinder",
4201
          delay,
4202
          x3,
4203
          y3,
4204
          z3,
4205
          msh
4206
        })
4207
      end
4208
    },
4209
    Elec = {
4210
      Create = function(cff, x, y, z)
4211
        local prt = CFuncs.Part.Create(EffectModel, "Neon", 0, 0, BrickColor.new("Pastel blue-green"), "Part", Vector3.new(1, 1, 1))
4212
        prt.Anchored = true
4213
        prt.CFrame = cff * CFrame.new(math.random(-x, x), math.random(-y, y), math.random(-z, z))
4214
        prt.CFrame = CFrame.new(prt.Position)
4215
        game:GetService("Debris"):AddItem(prt, 2)
4216
        local xval = math.random() / 2
4217
        local yval = math.random() / 2
4218
        local zval = math.random() / 2
4219
        local msh = CFuncs.Mesh.Create("BlockMesh", prt, "", "", Vector3.new(0, 0, 0), Vector3.new(xval, yval, zval))
4220
        table.insert(Effects, {
4221
          prt,
4222
          "Elec",
4223
          0.1,
4224
          x,
4225
          y,
4226
          z,
4227
          xval,
4228
          yval,
4229
          zval
4230
        })
4231
      end
4232
    },
4233
    Ring = {
4234
      Create = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay)
4235
        local prt = CFuncs.Part.Create(EffectModel, "SmoothPlastic", 0, 0, brickcolor, "Effect", Vector3.new())
4236
        prt.Anchored = true
4237
        prt.CFrame = cframe
4238
        local msh = CFuncs.Mesh.Create("CylinderMesh", prt, "", "", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
4239
        game:GetService("Debris"):AddItem(prt, 10)
4240
        table.insert(Effects, {
4241
          prt,
4242
          "Cylinder",
4243
          delay,
4244
          x3,
4245
          y3,
4246
          z3,
4247
          msh
4248
        })
4249
      end
4250
    },
4251
    Wave = {
4252
      Create = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay)
4253
        local prt = CFuncs.Part.Create(EffectModel, "SmoothPlastic", 0, 0, brickcolor, "Effect", Vector3.new())
4254
        prt.Anchored = true
4255
        prt.CFrame = cframe
4256
        local msh = CFuncs.Mesh.Create("SpecialMesh", prt, "FileMesh", "rbxassetid://20329976", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
4257
        game:GetService("Debris"):AddItem(prt, 10)
4258
        table.insert(Effects, {
4259
          prt,
4260
          "Cylinder",
4261
          delay,
4262
          x3,
4263
          y3,
4264
          z3,
4265
          msh
4266
        })
4267
      end
4268
    },
4269
    Break = {
4270
      Create = function(brickcolor, cframe, x1, y1, z1)
4271
        local prt = CFuncs.Part.Create(EffectModel, "Neon", 0, 0, brickcolor, "Effect", Vector3.new(0.5, 0.5, 0.5))
4272
        prt.Anchored = true
4273
        prt.CFrame = cframe * CFrame.fromEulerAnglesXYZ(math.random(-50, 50), math.random(-50, 50), math.random(-50, 50))
4274
        local msh = CFuncs.Mesh.Create("SpecialMesh", prt, "Sphere", "", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
4275
        local num = math.random(10, 50) / 1000
4276
        game:GetService("Debris"):AddItem(prt, 10)
4277
        table.insert(Effects, {
4278
          prt,
4279
          "Shatter",
4280
          num,
4281
          prt.CFrame,
4282
          math.random() - math.random(),
4283
          0,
4284
          math.random(50, 100) / 100
4285
        })
4286
      end
4287
    },
4288
    Fire = {
4289
      Create = function(brickcolor, cframe, x1, y1, z1, delay)
4290
        local prt = CFuncs.Part.Create(EffectModel, "Neon", 0, 0, brickcolor, "Effect", Vector3.new())
4291
        prt.Anchored = true
4292
        prt.CFrame = cframe
4293
        msh = CFuncs.Mesh.Create("BlockMesh", prt, "", "", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
4294
        game:GetService("Debris"):AddItem(prt, 10)
4295
        table.insert(Effects, {
4296
          prt,
4297
          "Fire",
4298
          delay,
4299
          1,
4300
          1,
4301
          1,
4302
          msh
4303
        })
4304
      end
4305
    },
4306
    FireWave = {
4307
      Create = function(brickcolor, cframe, x1, y1, z1)
4308
        local prt = CFuncs.Part.Create(EffectModel, "Neon", 0, 1, brickcolor, "Effect", Vector3.new())
4309
        prt.Anchored = true
4310
        prt.CFrame = cframe
4311
        msh = CFuncs.Mesh.Create("BlockMesh", prt, "", "", Vector3.new(0, 0, 0), Vector3.new(x1, y1, z1))
4312
        local d = Create("Decal")({
4313
          Parent = prt,
4314
          Texture = "rbxassetid://26356434",
4315
          Face = "Top"
4316
        })
4317
        local d = Create("Decal")({
4318
          Parent = prt,
4319
          Texture = "rbxassetid://26356434",
4320
          Face = "Bottom"
4321
        })
4322
        game:GetService("Debris"):AddItem(prt, 10)
4323
        table.insert(Effects, {
4324
          prt,
4325
          "FireWave",
4326
          1,
4327
          30,
4328
          math.random(400, 600) / 100,
4329
          msh
4330
        })
4331
      end
4332
    },
4333
    Lightning = {
4334
      Create = function(p0, p1, tym, ofs, col, th, tra, last)
4335
        local magz = (p0 - p1).magnitude
4336
        local curpos = p0
4337
        local trz = {
4338
          -ofs,
4339
          ofs
4340
        }
4341
        for i = 1, tym do
4342
          local li = CFuncs.Part.Create(EffectModel, "Neon", 0, tra or 0.4, col, "Ref", Vector3.new(th, th, magz / tym))
4343
          local ofz = Vector3.new(trz[math.random(1, 2)], trz[math.random(1, 2)], trz[math.random(1, 2)])
4344
          local trolpos = CFrame.new(curpos, p1) * CFrame.new(0, 0, magz / tym).p + ofz
4345
          li.Material = "Neon"
4346
          if tym == i then
4347
            local magz2 = (curpos - p1).magnitude
4348
            li.Size = Vector3.new(th, th, magz2)
4349
            li.CFrame = CFrame.new(curpos, p1) * CFrame.new(0, 0, -magz2 / 2)
4350
            table.insert(Effects, {
4351
              li,
4352
              "Disappear",
4353
              last
4354
            })
4355
          else
4356
            li.CFrame = CFrame.new(curpos, trolpos) * CFrame.new(0, 0, magz / tym / 2)
4357
            curpos = li.CFrame * CFrame.new(0, 0, magz / tym / 2).p
4358
            game.Debris:AddItem(li, 10)
4359
            table.insert(Effects, {
4360
              li,
4361
              "Disappear",
4362
              last
4363
            })
4364
          end
4365
        end
4366
      end
4367
    },
4368
    EffectTemplate = {}
4369
  }
4370
  local Invisible = true
4371
  function Reappear()
4372
    for _, i in pairs(AdvancingFortress:children()) do
4373
      if i:IsA("BasePart") then
4374
        coroutine.resume(coroutine.create(function(Part)
4375
          for i = 0, 1, 0.3 do
4376
            swait()
4377
            Part.Transparency = -i
4378
          end
4379
          Part.Transparency = 0
4380
        end), i)
4381
      end
4382
    end
4383
    for _, i in pairs(m:children()) do
4384
      if i:IsA("BasePart") then
4385
        coroutine.resume(coroutine.create(function(Part)
4386
          for i = 0, 1, 0.3 do
4387
            swait()
4388
            Part.Transparency = i
4389
          end
4390
          Part.Transparency = 0
4391
        end), i)
4392
      end
4393
    end
4394
  end
4395
  function ReappearArmorOnly()
4396
    for _, i in pairs(m:children()) do
4397
      if i:IsA("BasePart") then
4398
        coroutine.resume(coroutine.create(function(Part)
4399
          for i = 0, 1, 0.3 do
4400
            swait()
4401
            Part.Transparency = i
4402
          end
4403
          Part.Transparency = 0
4404
		for _,v in pairs(KQ) do
4405
			St=v.Weld.Part1.Name
4406
			if St=='FHead' then
4407
				St='Head'
4408
			end
4409
			v.Weld.Part1=Character[St]
4410
		end
4411
        end), i)
4412
      end
4413
    end
4414
  end
4415
  function Disappear()
4416
    for _, i in pairs(AdvancingFortress:children()) do
4417
      if i:IsA("BasePart") then
4418
        coroutine.resume(coroutine.create(function(Part)
4419
          for i = 0, 1, 0.3 do
4420
            swait()
4421
            Part.Transparency = i
4422
          end
4423
          Part.Transparency = 1
4424
        end), i)
4425
      end
4426
    end
4427
    for _, i in pairs(m:children()) do
4428
      if i:IsA("BasePart") then
4429
        coroutine.resume(coroutine.create(function(Part)
4430
          for i = 0, 1, 0.3 do
4431
            swait()
4432
            Part.Transparency = i
4433
          end
4434
          Part.Transparency = 1
4435
        end), i)
4436
      end
4437
    end
4438
  end
4439
  function DisappearArmorOnly()
4440
    for _, i in pairs(m:children()) do
4441
      if i:IsA("BasePart") then
4442
        coroutine.resume(coroutine.create(function(Part)
4443
          for i = 0, 1, 0.3 do
4444
            swait()
4445
            Part.Transparency = i
4446
          end
4447
          Part.Transparency = 1
4448
		for _,v in pairs(KQ) do
4449
			St=v.Weld.Part1.Name
4450
			if St=='Head' then
4451
			St='FHead'
4452
			end
4453
			v.Weld.Part1=AdvancingFortress[St]
4454
		end
4455
	end), i)
4456
      end
4457
    end
4458
  end
4459
  function CamShake(time, freq)
4460
    coroutine.resume(coroutine.create(function()
4461
      local cam = game:GetService("Workspace").CurrentCamera
4462
      local time = 10
4463
      local seed = Vector3.new(math.random(100, 200) / freq, math.random(100, 200) / freq, 0)
4464
      if math.random(1, 2) == 1 then
4465
        seed = Vector3.new(-seed.x, seed.y, 0)
4466
      end
4467
      if math.random(1, 2) == 1 then
4468
        seed = Vector3.new(seed.x, -seed.y, 0)
4469
      end
4470
      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)
4471
      for i = 1, time do
4472
        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)
4473
        wait()
4474
      end
4475
    end))
4476
  end
4477
  local ora = false
4478
  function ORA()
4479
    attack = true
4480
    local S = CFuncs.Sound.Create("", Torso, 3, 1)
4481
    S.Looped = true
4482
    if ora == true then
4483
      while ora == true do
4484
        CFuncs.Sound.Create("200632136", HitboxL, 0.3, math.random(1, 1.2))
4485
        MagnitudeDamage(HitboxL, 5, 4, 10, 0, "Normal", "260430117", 1)
4486
        for i = 0, 1, 0.8 do
4487
          swait()
4488
          RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1, -4), 0.5)
4489
          PlayAnimationFromTable({
4490
            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),
4491
            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),
4492
            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),
4493
            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),
4494
            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),
4495
            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)
4496
          }, 0.8, false)
4497
        end
4498
        CFuncs.Sound.Create("200632136", HitboxR, 0.3, math.random(1, 1.2))
4499
        MagnitudeDamage(HitboxR, 5, 4, 10, 0, "Normal", "260430117", 1)
4500
        for i = 0, 1, 0.8 do
4501
          swait()
4502
          RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1, -4), 0.5)
4503
          PlayAnimationFromTable({
4504
            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),
4505
            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),
4506
            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),
4507
            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),
4508
            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),
4509
            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)
4510
          }, 0.8, false)
4511
        end
4512
        CFuncs.Sound.Create("200632136", HitboxL, 0.3, math.random(1, 1.2))
4513
        MagnitudeDamage(HitboxL, 5, 4, 10, 0, "Normal", "260430117", 1)
4514
        for i = 0, 1, 0.8 do
4515
          swait()
4516
          RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1, -4), 0.5)
4517
          PlayAnimationFromTable({
4518
            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),
4519
            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),
4520
            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),
4521
            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),
4522
            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),
4523
            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)
4524
          }, 0.8, false)
4525
        end
4526
        CFuncs.Sound.Create("200632136", HitboxR, 0.3, math.random(1, 1.2))
4527
        MagnitudeDamage(HitboxR, 5, 4, 10, 0, "Normal", "260430117", 1)
4528
        for i = 0, 1, 0.8 do
4529
          swait()
4530
          RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1, -4), 0.5)
4531
          PlayAnimationFromTable({
4532
            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),
4533
            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),
4534
            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),
4535
            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),
4536
            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),
4537
            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)
4538
          }, 0.8, false)
4539
        end
4540
        CFuncs.Sound.Create("200632136", HitboxL, 0.3, math.random(1, 1.2))
4541
        MagnitudeDamage(HitboxL, 5, 4, 10, 0, "Normal", "260430117", 1)
4542
      end
4543
    end
4544
    S:Stop()
4545
    local S2 = CFuncs.Sound.Create("", Torso, 1.5, 1)
4546
    for i = 0, 1, 0.13 do
4547
      swait()
4548
      RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1, -3), 0.5)
4549
      PlayAnimationFromTable({
4550
        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),
4551
        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),
4552
        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),
4553
        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),
4554
        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),
4555
        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)
4556
      }, 0.2, false)
4557
    end
4558
    CFuncs.Sound.Create("471881954", HitboxR, 1, 1)
4559
    MagnitudeDamage(HitboxR, 7, 10, 15, 50, "Normal", "610359590", 1)
4560
    for i = 0, 1, 0.1 do
4561
      swait()
4562
      RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1, -5), 0.3)
4563
      PlayAnimationFromTable({
4564
        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),
4565
        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),
4566
        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),
4567
        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),
4568
        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),
4569
        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)
4570
      }, 0.6, false)
4571
    end
4572
    attack = false
4573
  end
4574
  function CastleCrusherFist()
4575
    attack = true
4576
    STDamage = true
4577
    local S2 = CFuncs.Sound.Create("", Torso, 1, 1)
4578
    for i = 0, 1, 0.1 do
4579
      swait()
4580
      Effects.Block.Create(BrickColor.new("Pastel blue-green"), HitboxR.CFrame, 1, 1, 1, 4, 4, 4, 0.3, 1)
4581
      Effects.Break.Create(BrickColor.new("Pastel blue-green"), HitboxR.CFrame, 0.5, 0.5, 0.5)
4582
      RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1, -2), 0.2)
4583
      PlayAnimationFromTable({
4584
        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),
4585
        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),
4586
        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),
4587
        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),
4588
        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),
4589
        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)
4590
      }, 0.2, false)
4591
    end
4592
    MagnitudeDamage(HitboxR, 10, 50, 80, 100, "Normal", "610359515", 1)
4593
    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)
4594
    CFuncs.Sound.Create("471881980", HitboxR, 1, 0.9)
4595
    CFuncs.Sound.Create("471881954", HitboxR, 1, 0.8)
4596
    for i = 0, 1, 0.08 do
4597
      swait()
4598
      Effects.Block.Create(BrickColor.new("Pastel blue-green"), HitboxR.CFrame, 1, 1, 1, 4, 4, 4, 0.3, 1)
4599
      Effects.Break.Create(BrickColor.new("Pastel blue-green"), HitboxR.CFrame, 0.5, 0.5, 0.5)
4600
      RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1, -5), 0.3)
4601
      PlayAnimationFromTable({
4602
        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),
4603
        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),
4604
        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),
4605
        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),
4606
        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),
4607
        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)
4608
      }, 0.6, false)
4609
    end
4610
    STDamage = false
4611
    attack = false
4612
  end
4613
  function CastleCrusherFist()
4614
    attack = true
4615
    STDamage = true
4616
    local S2 = CFuncs.Sound.Create("", Torso, 1, 1)
4617
    for i = 0, 1, 0.1 do
4618
      swait()
4619
      Effects.Block.Create(BrickColor.new("Pastel blue-green"), HitboxR.CFrame, 1, 1, 1, 4, 4, 4, 0.3, 1)
4620
      Effects.Break.Create(BrickColor.new("Pastel blue-green"), HitboxR.CFrame, 0.5, 0.5, 0.5)
4621
      RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1, -2), 0.5)
4622
      PlayAnimationFromTable({
4623
        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),
4624
        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),
4625
        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),
4626
        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),
4627
        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),
4628
        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)
4629
      }, 0.2, false)
4630
    end
4631
    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)
4632
    Character.HumanoidRootPart.Velocity = Character.HumanoidRootPart.CFrame.lookVector * 140
4633
    CFuncs.Sound.Create("471881980", HitboxR, 1, 0.9)
4634
    CFuncs.Sound.Create("471881954", HitboxR, 1, 0.8)
4635
    for i = 0, 1, 0.08 do
4636
      swait()
4637
      MagnitudeDamage(HitboxR, 5, 50, 80, 100, "Normal", "610359515", 1)
4638
      Effects.Block.Create(BrickColor.new("Pastel blue-green"), HitboxR.CFrame, 1, 1, 1, 4, 4, 4, 0.3, 1)
4639
      Effects.Break.Create(BrickColor.new("Pastel blue-green"), HitboxR.CFrame, 0.5, 0.5, 0.5)
4640
      RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1, -5), 1)
4641
      PlayAnimationFromTable({
4642
        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),
4643
        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),
4644
        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),
4645
        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),
4646
        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),
4647
        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)
4648
      }, 0.6, false)
4649
    end
4650
    STDamage = false
4651
    attack = false
4652
  end
4653
4654
4655
distance2__=0
4656
AdvancingFortress.FHead.face:remove()
4657
4658
function Lattack()
4659
    attack = true
4660
    local S = CFuncs.Sound.Create("", Torso, 3, 1)
4661
    S.Looped = true
4662
    if Long then
4663
      while Long and distance2__>-15 do-- max range
4664
	distance2__=distance2__-1
4665
4666
        for i = 0, 1, 0.8 do
4667
          swait()
4668
          RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1, distance2__), 0.5)
4669
          PlayAnimationFromTable({
4670
            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),
4671
            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),
4672
            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),
4673
            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),
4674
            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),
4675
            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)
4676
          }, 0.8, false)
4677
        end
4678
4679
end
4680
        for i = 0, 1, 0.8 do
4681
          swait()
4682
          PlayAnimationFromTable({
4683
            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),
4684
            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),
4685
            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),
4686
            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),
4687
            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),
4688
            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)
4689
          }, 0.8, false)
4690
        end
4691
        CFuncs.Sound.Create("200632136", HitboxL, 0.3, math.random(1, 1.2))
4692
        MagnitudeDamage(HitboxL, 5, 4, 50, 0, "Normal", "260430117", 1)
4693
 PlayAnimationFromTable({
4694
            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),
4695
            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),
4696
            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),
4697
            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),
4698
            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),
4699
            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)
4700
          }, 0.8, false)
4701
        end
4702
wait(1)
4703
distance2__=0
4704
    STDamage = false
4705
    attack = false
4706
  end
4707
4708
4709
4710
4711
  function weld5(part0, part1, c0, c1)
4712
    local weeld = Instance.new("Weld", part0)
4713
    weeld.Part0 = part0
4714
    weeld.Part1 = part1
4715
    weeld.C0 = c0
4716
    weeld.C1 = c1
4717
    return weeld
4718
  end
4719
  local Grab = false
4720
  function GRABEMBOIGRABEM()
4721
    attack = true
4722
    gp = nil
4723
    con1 = HitboxR.Touched:connect(function(hit)
4724
      local ht = hit.Parent
4725
      local hum1 = ht:FindFirstChild("Humanoid")
4726
      if Grab == false then
4727
        if hum1 ~= nil and hit.Parent ~= Character then
4728
          hum1.PlatformStand = true
4729
          gp = ht
4730
          Grab = true
4731
          local asd = weld5(RightArm, ht:FindFirstChild("Torso"), CFrame.new(0, -1.5, 0), CFrame.new(0, 0, 0))
4732
          asd.Parent = RightArm
4733
          asd.Name = "asd"
4734
          asd.C0 = asd.C0 * CFrame.Angles(math.rad(-90), 0, 0)
4735
          CFuncs.Sound.Create("200632821", Torso, 1, 1)
4736
        elseif hum1 == nil then
4737
          con1:disconnect()
4738
          wait()
4739
          return
4740
        end
4741
      end
4742
    end)
4743
    for i = 0, 1, 0.2 do
4744
      swait()
4745
      RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1, -2), 0.3)
4746
      PlayAnimationFromTable({
4747
        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),
4748
        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),
4749
        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),
4750
        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),
4751
        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),
4752
        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)
4753
      }, 0.3, false)
4754
    end
4755
    for i = 0, 1, 0.1 do
4756
      swait()
4757
      RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1, -6), 0.3)
4758
      PlayAnimationFromTable({
4759
        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),
4760
        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),
4761
        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),
4762
        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),
4763
        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),
4764
        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)
4765
      }, 0.3, false)
4766
    end
4767
    if Grab == true then
4768
      for i = 1, 5 do
4769
        for i = 0, 1, 0.35 do
4770
          swait()
4771
          RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 13, -6), 0.3)
4772
          PlayAnimationFromTable({
4773
            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),
4774
            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),
4775
            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),
4776
            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),
4777
            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),
4778
            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)
4779
          }, 0.4, false)
4780
        end
4781
        for i = 0, 1, 0.3 do
4782
          swait()
4783
          RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1, -6), 0.3)
4784
          PlayAnimationFromTable({
4785
            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),
4786
            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),
4787
            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),
4788
            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),
4789
            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),
4790
            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)
4791
          }, 0.7, false)
4792
        end
4793
        local hit, pos = rayCast(HitboxR.Position, CFrame.new(RootPart.Position, RootPart.Position - Vector3.new(0, 1, 0)).lookVector, 100, Character)
4794
        if hit ~= nil then
4795
          MagnitudeDamage(HitboxR, 5, 10, 30, 0, "Normal", "610359515", 1.3)
4796
          Effects.Block.Create(BrickColor.new("Pastel blue-green"), CFrame.new(pos), 1, 1, 1, 0.7, 0.7, 0.7, 0.09, 1)
4797
          Effects.Wave.Create(BrickColor.new("Pastel blue-green"), CFrame.new(pos), 1, 1, 1, 0.7, 0.7, 0.7, 0.09)
4798
          Effects.Sphere.Create(BrickColor.new("Pastel blue-green"), CFrame.new(pos), 3, 3, 3, 5, 5, 5, 0.09)
4799
        end
4800
      end
4801
    end
4802
    for i, v in pairs(RightArm:GetChildren()) do
4803
      if v.Name == "asd" and v:IsA("Weld") then
4804
        v:Remove()
4805
      end
4806
    end
4807
    Grab = false
4808
    con1:disconnect()
4809
    attack = false
4810
  end
4811
  local IsWearingArmor = false
4812
  function Armor(Mode)
4813
    attack = true
4814
    if IsWearingArmor == false and Mode == "On" then
4815
      IsWearingArmor = true
4816
      Disappear()
4817
      swait(10)
4818
      ReappearArmorOnly()
4819
      Character.Humanoid.MaxHealth = 500
4820
      Character.Humanoid.Health = 500
4821
      AHandleRWeld.Part0 = Character["Right Arm"]
4822
      AHandleLWeld.Part0 = Character["Left Arm"]
4823
      for i, v in pairs(AdvancingFortress:GetChildren()) do
4824
        if v:IsA("BasePart") then
4825
          v.Transparency = 1
4826
        end
4827
      end
4828
      for i, v in pairs(Character:GetChildren()) do
4829
        if v:IsA("Accessory") then
4830
          v.Handle.Transparency = 1
4831
        end
4832
      end
4833
    elseif IsWearingArmor == true and Mode == "Off" then
4834
      IsWearingArmor = false
4835
      DisappearArmorOnly()
4836
      for i, v in pairs(Character:GetChildren()) do
4837
        if v:IsA("Accessory") then
4838
          v.Handle.Transparency = 0
4839
        end
4840
      end
4841
      swait(10)
4842
      Reappear()
4843
      Character.Humanoid.MaxHealth = 100
4844
      Character.Humanoid.Health = 100
4845
4846
      AHandleRWeld.Part0 = RightArm
4847
      AHandleLWeld.Part0 = LeftArm
4848
4849
      for i, v in pairs(AdvancingFortress:GetChildren()) do
4850
        if v:IsA("BasePart") then
4851
          v.Transparency = 0
4852
        end
4853
      end
4854
    end
4855
    attack = false
4856
  end
4857
  local ShieldMode = false
4858
  local ShieldCharge = false
4859
  function HoloHexShield()
4860
    attack = true
4861
    Shield.Parent = m
4862
    Shield.CanCollide = true
4863
    if ShieldMode == true then
4864
      while ShieldMode == true do
4865
        swait()
4866
        Effects.Elec.Create(Shield.CFrame, 6, 6, 6)
4867
        RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1.3, -4), 0.3)
4868
        PlayAnimationFromTable({
4869
          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),
4870
          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),
4871
          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),
4872
          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),
4873
          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),
4874
          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)
4875
        }, 0.3, false)
4876
      end
4877
    end
4878
    Shield.CanCollide = false
4879
    CFuncs.Sound.Create("200632211", HitboxR, 1, 0.8)
4880
    CFuncs.Sound.Create("200632875", HitboxR, 1, 0.9)
4881
    Character.HumanoidRootPart.Velocity = Character.HumanoidRootPart.CFrame.lookVector * 160
4882
    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)
4883
    for i = 0, 1, 0.05 do
4884
      swait()
4885
      MagnitudeDamage(Shield, 5, 10, 15, 20, "Normal", "610359515", 1.3)
4886
      Effects.Elec.Create(Shield.CFrame, 6, 6, 6)
4887
      RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1.3, -3), 1)
4888
      PlayAnimationFromTable({
4889
        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),
4890
        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),
4891
        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),
4892
        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),
4893
        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),
4894
        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)
4895
      }, 0.5, false)
4896
    end
4897
    Shield.Parent = nil
4898
    attack = false
4899
  end
4900
  Mouse.Button1Down:connect(function()
4901
    if attack == false and attacktype == 1 then
4902
      attacktype = 2
4903
      attackone()
4904
    elseif attack == false and attacktype == 2 then
4905
      attacktype = 1
4906
      attacktwo()
4907
    end
4908
  end)
4909
  game.Lighting.Outlines = false
4910
  function attackone()
4911
    attack = true
4912
    for i = 0, 1, 0.12 do
4913
      swait()
4914
      RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1.3, -4), 0.3)
4915
      PlayAnimationFromTable({
4916
        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),
4917
        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),
4918
        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),
4919
        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),
4920
        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),
4921
        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)
4922
      }, 0.3, false)
4923
    end
4924
    MagnitudeDamage(HitboxR, 7, 10, 15, math.random(1, 3), "Normal", "260430079", 1)
4925
    CFuncs.Sound.Create("200632136", HitboxR, 1, 1)
4926
    RootPart.Velocity = RootPart.CFrame.lookVector * 40
4927
    for i = 0, 1, 0.11 do
4928
      swait()
4929
      RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1.3, -4), 0.3)
4930
      PlayAnimationFromTable({
4931
        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),
4932
        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),
4933
        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),
4934
        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),
4935
        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),
4936
        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)
4937
      }, 0.45, false)
4938
    end
4939
    attack = false
4940
  end
4941
  function attacktwo()
4942
    attack = true
4943
    for i = 0, 1, 0.12 do
4944
      swait()
4945
      RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1.3, -4), 0.3)
4946
      PlayAnimationFromTable({
4947
        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),
4948
        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),
4949
        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),
4950
        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),
4951
        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),
4952
        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)
4953
      }, 0.34, false)
4954
    end
4955
    MagnitudeDamage(HitboxL, 7, 10, 15, math.random(1, 3), "Normal", "260430079", 1.1)
4956
    CFuncs.Sound.Create("200632136", HitboxL, 1, 1)
4957
    RootPart.Velocity = RootPart.CFrame.lookVector * 40
4958
    for i = 0, 1, 0.12 do
4959
      swait()
4960
      RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(0, 1.3, -4), 0.3)
4961
      PlayAnimationFromTable({
4962
        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),
4963
        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),
4964
        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),
4965
        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),
4966
        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),
4967
        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)
4968
      }, 0.45, false)
4969
    end
4970
    attack = false
4971
  end
4972
  function findNearestTorso(pos)
4973
    local list = game.Workspace:children()
4974
    local torso
4975
    local dist = 1000
4976
    local temp, human, temp2
4977
    for x = 1, #list do
4978
      temp2 = list[x]
4979
      if temp2.className == "Model" and temp2.Name ~= Character.Name then
4980
        temp = temp2:findFirstChild("Torso")
4981
        human = temp2:findFirstChild("Humanoid")
4982
        if temp ~= nil and human ~= nil and human.Health > 0 and dist > (temp.Position - pos).magnitude then
4983
          local dohit = true
4984
          if dohit == true then
4985
            torso = temp
4986
            dist = (temp.Position - pos).magnitude
4987
          end
4988
        end
4989
      end
4990
    end
4991
    return torso, dist
4992
  end
4993
  function TrueAim(aim)
4994
    local target, distance = findNearestTorso(Mouse.Hit.p)
4995
    local tehcf = HitboxR.CFrame * CFrame.fromEulerAnglesXYZ(1.57, 0, 0).lookVector
4996
    if aim ~= nil then
4997
      tehcf = aim
4998
    end
4999
    table.insert(Effects, {
5000
      tehcf,
5001
      "Shoot",
5002
      30,
5003
      HitboxR.Position,
5004
      10,
5005
      15,
5006
      0,
5007
      3,
5008
      HitboxR,
5009
      target
5010
    })
5011
  end
5012
  function FireProjectiles()
5013
    attack = true
5014
    Humanoid.WalkSpeed = 20
5015
    CFuncs.Sound.Create("300915902", HitboxR, 1, 0.8)
5016
    for i = 0, 1, 0.1 do
5017
      swait()
5018
      Effects.Elec.Create(HitboxR.CFrame, 2, 2, 2)
5019
      PlayAnimationFromTable({
5020
        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),
5021
        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),
5022
        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),
5023
        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),
5024
        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),
5025
        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)
5026
      }, 0.3, false)
5027
    end
5028
    for i = 0, 1, 0.1 do
5029
      swait()
5030
      Effects.Elec.Create(HitboxR.CFrame, 3, 3, 3)
5031
      Effects.Block.Create(BrickColor.new("Pastel blue-green"), HitboxR.CFrame, 1, 1, 1, 1, 1, 1, 0.1)
5032
      Effects.Sphere2.Create(BrickColor.new("Pastel blue-green"), HitboxR.CFrame, 1, 1, 1, 1, 1, 1, 0.1)
5033
      PlayAnimationFromTable({
5034
        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),
5035
        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),
5036
        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),
5037
        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),
5038
        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),
5039
        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)
5040
      }, 0.2, false)
5041
    end
5042
    for i = 1, 10 do
5043
      for i = 0, 1, 0.3 do
5044
        swait()
5045
        Effects.Elec.Create(HitboxR.CFrame, 3, 3, 3)
5046
        Effects.Sphere2.Create(BrickColor.new("Pastel blue-green"), HitboxR.CFrame, 1, 1, 1, 1, 1, 1, 0.1)
5047
        PlayAnimationFromTable({
5048
          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),
5049
          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),
5050
          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),
5051
          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),
5052
          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),
5053
          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)
5054
        }, 0.3, false)
5055
      end
5056
      CFuncs.Sound.Create("300916105", HitboxR, 1, 1.2)
5057
      CFuncs.Sound.Create("300916014", HitboxR, 1, 1)
5058
      Effects.Sphere2.Create(BrickColor.new("Pastel blue-green"), HitboxR.CFrame, 1, 1, 1, 2, 2, 2, 0.07)
5059
      local MouseLook = CFrame.new((HitboxR.Position + Mouse.Hit.p) / 2, Mouse.Hit.p)
5060
      TrueAim(MouseLook.lookVector)
5061
      for i = 0, 1, 0.3 do
5062
        swait()
5063
        Effects.Elec.Create(HitboxR.CFrame, 3, 3, 3)
5064
        Effects.Sphere2.Create(BrickColor.new("Pastel blue-green"), HitboxR.CFrame, 1, 1, 1, 1, 1, 1, 0.1)
5065
        PlayAnimationFromTable({
5066
          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),
5067
          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),
5068
          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),
5069
          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),
5070
          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),
5071
          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)
5072
        }, 0.3, false)
5073
      end
5074
    end
5075
    Humanoid.WalkSpeed = 20
5076
    attack = false
5077
  end
5078
SHRA=false
5079
5080
Check=false
5081
dimension=workspace
5082
Mouse.KeyUp:connect(function(k)
5083
	if k=='e' then
5084
		Long=false
5085
	end
5086
end)
5087
reload2=false
5088
hand=true -- collect hands
5089
  Mouse.KeyDown:connect(function(k)
5090
    k = k:lower()
5091
	if k=='r' and dimension==workspace then
5092
	Meg=Instance.new('Part')
5093
	Meg.Parent=Character
5094
	Meg.CFrame=Mouse.Hit
5095
	Meg.Transparency=1
5096
	Meg.CanCollide=false
5097
	Meg.Touched:connect(function(h)
5098
		if h.Parent~=Character or h.Parent~=workspace or h.Parent~=AdvancingFortress then
5099
		if h.Parent:findFirstChild('Torso')~=nil and h.Parent:findFirstChild('Humanoid')~=nil then
5100
			enem=h.Parent
5101
		
5102
			end
5103
		end
5104
	end)
5105
	wait(.1)
5106
	if enem~=nil then
5107
		eclone(enem.Torso)
5108
		
5109
	end
5110
	elseif k=='t' then
5111
	if dimension==workspace then
5112
		dimension=workspace.CurrentCamera
5113
		workspace.CurrentCamera.FieldOfView=180
5114
	elseif dimension==workspace.CurrentCamera then
5115
		dimension=workspace
5116
		workspace.CurrentCamera.FieldOfView=70
5117
	end
5118
	Character.Parent=dimension
5119
	elseif k=='y' then
5120
		if YOURCLONE~=nil then
5121
			Sav=YOURCLONE.Torso.CFrame
5122
			Sav2=YOURCLONE.Humanoid.Health
5123
			YOURCLONE.Torso.CFrame=Character.Torso.CFrame
5124
			Character.Torso.CFrame=Sav
5125
			YOURCLONE.Humanoid.Health=Character.Humanoid.Health
5126
			Character.Humanoid.Health=Sav2
5127
		end
5128
		if YOURCLONE== nil then
5129
		yclone()
5130
		end
5131
	end
5132
	if dimension==workspace then	
5133
	if k=='f' and IsWearingArmor == false and Invisible == false and reload2==false then
5134
		reload2=true
5135
		M=Instance.new('Part',Character)
5136
		M.Shape='Ball'
5137
		M.Material='Glass'
5138
		M.BrickColor=BrickColor.new('Gold')
5139
		M.Transparency=.5
5140
		M.Position=Character.Torso.Position
5141
		M.Size=Vector3.new(10,10,10)
5142
		M.CanCollide=false
5143
		M.Touched:connect(function(h)
5144
		if h.Parent~=Character or h.Parent~=workspace or h.Parent~=AdvancingFortress or h.Parent~=MEF then
5145
			if h:IsA('Part') and h.Anchored==false then
5146
				h.Velocity=Vector3.new(math.random(-70,70),math.random(40,50),math.random(-70,70))
5147
			end	
5148
			end
5149
		end)
5150
		W=Instance.new('Weld',Character)
5151
		W.Part0=M
5152
		W.Part1=Character.Torso
5153
		wait(10)
5154
		M:remove()
5155
		wait(10)
5156
		reload2=false
5157
	end
5158
if k=='e' and IsWearingArmor == false and Invisible == false  then
5159
	Long=true
5160
Lattack()
5161
end
5162
    if attack == false and ora == false and k == "z" and IsWearingArmor == false and Invisible == false  then
5163
      ora = true
5164
      ORA()
5165
    elseif attack == false and k == "x" and IsWearingArmor == false and Invisible == false then
5166
      GRABEMBOIGRABEM()
5167
    elseif attack == false and k=='g' then
5168
--      FireProjectiles()--thats lame
5169
if changeidle==1 then
5170
	changeidle=2 
5171
	else changeidle=1
5172
end
5173
5174
end
5175
	end
5176
5177
    if attack == false and k == "q" and Invisible == false and IsWearingArmor == false then
5178
      Invisible = true
5179
      Effects.Sphere.Create(BrickColor.new("Pastel blue-green"), Torso.CFrame, 1, 1, 1, 4, 4, 4, 0.1)
5180
      Effects.Block.Create(BrickColor.new("Pastel blue-green"), Torso.CFrame, 1, 1, 1, 4, 4, 4, 0.1, 1)
5181
      Disappear()
5182
    elseif attack == false and k == "q" and Invisible == true and IsWearingArmor == false then
5183
      Invisible = false
5184
      Effects.Sphere.Create(BrickColor.new("Pastel blue-green"), Torso.CFrame, 1, 1, 1, 4, 4, 4, 0.08)
5185
5186
      for i = 1, 2 do
5187
        Effects.Block.Create(BrickColor.new("Pastel blue-green"), Torso.CFrame, 1, 1, 1, 4, 4, 4, 0.1, 1)
5188
      end
5189
      for i = 1, 20 do
5190
        Effects.Break.Create(BrickColor.new("Pastel blue-green"), Torso.CFrame, 1, 1, 1)
5191
      end
5192
      Reappear()
5193
      G=Instance.new('Sound',AdvancingFortress.FTorso)
5194
	  G.Name='FLEF'
5195
	  G.SoundId='rbxassetid://1275713993'
5196
	  G.Volume=3
5197
	  G:Play()
5198
    elseif attack == false and ShieldMode == false and k == "c" and IsWearingArmor == false and Invisible == false and dimension==workspace then
5199
      ShieldMode = true
5200
      HoloHexShield()
5201
    elseif attack == false and k == "v" and IsWearingArmor == false and Invisible == false and dimension==workspace then
5202
      CastleCrusherFist()
5203
5204
end
5205
    --[[if k == "[" and IsWearingArmor == false and Invisible == false then
5206
      Armor("On")
5207
    end
5208
    if k == "]" and IsWearingArmor == true and Invisible == false then
5209
      Armor("Off")
5210
    end--]]
5211
  end)
5212
5213
 Mouse.KeyUp:connect(function(k)
5214
    k = k:lower()
5215
    if attack == true and ora == true and k == "z" and IsWearingArmor == false then
5216
      ora = false
5217
    elseif attack == true and ShieldMode == true and k == "c" and IsWearingArmor == false then
5218
      ShieldMode = false
5219
 	end
5220
  end)
5221
--  coroutine.resume(coroutine.create(function(Part, Part2)
5222
--    while Part.Parent ~= nil do
5223
--      swait(math.random(100, 150))
5224
--      for i = 0, 1, 0.2 do
5225
--        wait()
5226
--        Eye1.Mesh.Scale = Vector3.new(1, 0.7 - 1 * i, 1)
5227
--        Eye2.Mesh.Scale = Vector3.new(1, 0.7 - 1 * i, 1)
5228
--      end
5229
--      for i = 0, 1, 0.2 do
5230
--        swait()
5231
--        Eye1.Mesh.Scale = Vector3.new(1, 0.7 + 0.3 * i, 1)
5232
--        Eye2.Mesh.Scale = Vector3.new(1, 0.7 + 0.3 * i, 1)
5233
--      end
5234
--    end
5235
--  end), Eye1, Eye2)
5236
	tfk=CFuncs.Sound.Create(1325068271, Character.Torso, 1.5, 1)
5237
  tfk.Name='THEME'
5238
	tfk.Looped=true
5239
	changeidle=1
5240
	YOURCLONE=nil
5241
	candecide=true
5242
	Humanoid=Character.Humanoid
5243
while true do
5244
5245
5246
for _,v in pairs(AdvancingFortress.FTorso:GetChildren()) do	
5247
	end
5248
    swait()
5249
    for i, v in pairs(Character:children()) do
5250
      if v:IsA("Part") and IsWearingArmor == true then
5251
        v.Anchored = false
5252
      end
5253
    end
5254
    for i, v in pairs(AdvancingFortress:GetChildren()) do
5255
      if v:IsA("Part") then
5256
        v.Material = "SmoothPlastic"
5257
        v.CanCollide = false
5258
      elseif v:IsA("Humanoid") then
5259
        v:remove()
5260
      elseif v:IsA("Accessory") then
5261
        v:remove()
5262
      elseif v:IsA("Shirt") then
5263
        v:remove()
5264
      elseif v:IsA("Pants") then
5265
        v:remove()
5266
      elseif v:IsA("Script") or v:IsA("LocalScript") then
5267
        v:remove()
5268
      elseif v:IsA("BodyColors") then
5269
        v:remove()
5270
      end
5271
    end
5272
    AHandleR.Transparency = 1
5273
    AHandleL.Transparency = 1
5274
    RootPart.Transparency = 1
5275
    HitboxR.Transparency = 1
5276
    HitboxL.Transparency = 1
5277
    Head.BrickColor = BrickColor.new("Pastel blue-green")
5278
    Torso.BrickColor = BrickColor.new("Pastel blue-green")
5279
    RightArm.BrickColor = BrickColor.new("Pastel blue-green")
5280
    LeftArm.BrickColor = BrickColor.new("Pastel blue-green")
5281
    RightLeg.BrickColor = BrickColor.new("Pastel blue-green")
5282
    LeftLeg.BrickColor = BrickColor.new("Pastel blue-green")
5283
    RootPart.Anchored = true
5284
    Torsovelocity = (Character.HumanoidRootPart.Velocity * Vector3.new(1, 0, 1)).magnitude
5285
    velocity = Character.HumanoidRootPart.Velocity.y
5286
    sine = sine + change
5287
    Shield.Anchored = true
5288
    Shield.CFrame = Shield.CFrame:lerp(RootPart.CFrame * CFrame.new(0, 0, -3.2), 1)
5289
    local hit, pos = rayCast(Character.HumanoidRootPart.Position, CFrame.new(Character.HumanoidRootPart.Position, Character.HumanoidRootPart.Position - Vector3.new(0, 1, 0)).lookVector, 4, Character)
5290
    if Character.HumanoidRootPart.Velocity.y > 1 and hit == nil then
5291
      Anim = "Jump"
5292
      if attack == false then
5293
        RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(-2, 1 + 0.5 * math.cos(sine / 20), 3), 0.5)
5294
        PlayAnimationFromTable({
5295
          CFrame.new(0,0,0) * CFrame.new(0, 0, 0) * CFrame.Angles(.5, -1, 0),
5296
          CFrame.new(0,1.5,0) * CFrame.new(0, 0, 0) * CFrame.Angles(1, 1, 0),
5297
          CFrame.new(1.5,0,0) * CFrame.new(-1, 0, -.3) * CFrame.Angles(1.5, 0, -1.5),
5298
          CFrame.new(-1.5,0,0) * CFrame.new(1, 0, -.5) * CFrame.Angles(3, 0, 1),
5299
          CFrame.new(.5,-2,0) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
5300
          CFrame.new(-.5,-2,0) * CFrame.new(0, 0.5, -0.3) * CFrame.Angles(-.5, 0, 0)
5301
		  		}, 0.3, false)
5302
      end
5303
    elseif Character.HumanoidRootPart.Velocity.y < -1 and hit == nil then
5304
      Anim = "Fall"
5305
      if attack == false then
5306
        RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(-2, 1 + 0.5 * math.cos(sine / 20), 3), 0.5)
5307
        PlayAnimationFromTable({
5308
          CFrame.new(0,0,0) * CFrame.new(0, 0, 0) * CFrame.Angles(1, -1, 1),
5309
          CFrame.new(0,1.5,0) * CFrame.new(0, 0, 0) * CFrame.Angles(-1, 1, 0.5),
5310
          CFrame.new(1.5,0,0) * CFrame.new(-1, 0, -.3) * CFrame.Angles(1.5, 0, -1.5),
5311
          CFrame.new(-1.5,0,0) * CFrame.new(1, 0, -.5) * CFrame.Angles(3, 0, 1),
5312
          CFrame.new(.5,-2,0) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
5313
          CFrame.new(-.5,-2,0) * CFrame.new(0, 0.5, -0.3) * CFrame.Angles(-.5, 0, 0)
5314
		  		}, 0.3, false)
5315
      end
5316
    elseif Torsovelocity < 1 and hit ~= nil then
5317
      Anim = "Idle"
5318
	if changeidle==1 then
5319
      if attack == false then
5320
        change = 1
5321
        RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(-2, 1 + 0.5 * math.cos(sine / 20), 3), 0.5)
5322
        PlayAnimationFromTable({
5323
          CFrame.new(0,0,0) * CFrame.new(0, 0, 0) * CFrame.Angles(1, -1, 1),
5324
          CFrame.new(0,1.5,0) * CFrame.new(0, 0, 0) * CFrame.Angles(-1, 1, 0.5),
5325
          CFrame.new(1.5,0,0) * CFrame.new(-1.2, 0, -.3) * CFrame.Angles(1.5, 0, -1.5),
5326
          CFrame.new(-1.5,0,0) * CFrame.new(1.5, 0.3, -.5) * CFrame.Angles(3, 0, 1),
5327
          CFrame.new(.5,-2,0) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
5328
          CFrame.new(-.5,-2,0) * CFrame.new(0, 0.5, -0.3) * CFrame.Angles(-.5, 0, 0)
5329
        }, 0.3, false)
5330
      end
5331
	elseif changeidle==2 then
5332
		        change = 1
5333
		if not attack then
5334
        RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(-2, 1 + 0.5 * math.cos(sine / 20), 3), 0.5)
5335
        PlayAnimationFromTable({
5336
          CFrame.new(0,0,0) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
5337
          CFrame.new(0,1.5,0) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
5338
          CFrame.new(1.5,0,0) * CFrame.new(-1.5, 0.4, -.5) * CFrame.Angles(3, 0, -1),
5339
          CFrame.new(-1.5,0,0) * CFrame.new(1.5, 0.4, -.5) * CFrame.Angles(3, 0, 1),
5340
          CFrame.new(.5,-2,0) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
5341
          CFrame.new(-.5,-2,0) * CFrame.new(0, 0.5, -0.3) * CFrame.Angles(-.5, 0, 0)
5342
        }, 0.3, false)
5343
end
5344
end
5345
    elseif Torsovelocity > 2 and hit ~= nil then
5346
      Anim = "Walk"
5347
      if attack == false then
5348
        RootPart.CFrame = RootPart.CFrame:lerp(Character.HumanoidRootPart.CFrame * CFrame.new(-2, 1 + 0.5 * math.cos(sine / 20), 3), 0.5)
5349
        PlayAnimationFromTable({
5350
          CFrame.new(0,0,0) * CFrame.new(0, 0, 0) * CFrame.Angles(-1, -1, 0),
5351
          CFrame.new(0,1.5,0) * CFrame.new(0, 0, 0) * CFrame.Angles(1, 0, 0),
5352
          CFrame.new(1.5,0,0) * CFrame.new(-1, 0, -.3) * CFrame.Angles(1.5, 0, -1.5),
5353
          CFrame.new(-1.5,0,0) * CFrame.new(1, 0, -.5) * CFrame.Angles(3, 0, 1),
5354
          CFrame.new(.5,-2,0) * CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0),
5355
          CFrame.new(-.5,-2,0) * CFrame.new(0, 0.5, -0.3) * CFrame.Angles(-.5, 0, 0)
5356
		  		}, 0.3, false)
5357
      end
5358
    end
5359
    if 0 < #Effects then
5360
      for e = 1, #Effects do
5361
        if Effects[e] ~= nil then
5362
          local Thing = Effects[e]
5363
          if Thing ~= nil then
5364
            local Part = Thing[1]
5365
            local Mode = Thing[2]
5366
            local Delay = Thing[3]
5367
            local IncX = Thing[4]
5368
            local IncY = Thing[5]
5369
            local IncZ = Thing[6]
5370
            if Thing[2] == "Shoot" then
5371
              local Look = Thing[1]
5372
              local move = 30
5373
              if Thing[8] == 3 then
5374
                move = 10
5375
              end
5376
              local hit, pos = rayCast(Thing[4], Thing[1], move, m)
5377
              if Thing[10] ~= nil then
5378
                da = pos
5379
                cf2 = CFrame.new(Thing[4], Thing[10].Position)
5380
                cfa = CFrame.new(Thing[4], pos)
5381
                tehCF = cfa:lerp(cf2, 0.2)
5382
                Thing[1] = tehCF.lookVector
5383
              end
5384
              local mag = (Thing[4] - pos).magnitude
5385
              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)
5386
              if Thing[8] == 2 then
5387
                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)
5388
              end
5389
              Thing[4] = Thing[4] + Look * move
5390
              Thing[3] = Thing[3] - 1
5391
              if 2 < Thing[5] then
5392
                Thing[5] = Thing[5] - 0.3
5393
                Thing[6] = Thing[6] - 0.3
5394
              end
5395
              if hit ~= nil then
5396
                Thing[3] = 0
5397
                if Thing[8] == 1 or Thing[8] == 3 then
5398
                  Damage(hit, hit, Thing[5], Thing[6], Thing[7], "Normal", RootPart, 0, "", 1)
5399
                elseif Thing[8] == 2 then
5400
                  Damage(hit, hit, Thing[5], Thing[6], Thing[7], "Normal", RootPart, 0, "", 1)
5401
                  if hit.Parent:findFirstChild("Humanoid") ~= nil or hit.Parent.Parent:findFirstChild("Humanoid") ~= nil then
5402
                    ref = CFuncs.Part.Create(workspace, "Neon", 0, 1, BrickColor.new("Pastel blue-green"), "Reference", Vector3.new())
5403
                    ref.Anchored = true
5404
                    ref.CFrame = CFrame.new(pos)
5405
                    CFuncs.Sound.Create("161006093", ref, 1, 1.2)
5406
                    game:GetService("Debris"):AddItem(ref, 0.2)
5407
                    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)
5408
                    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)
5409
                    MagnitudeDamage(ref, 15, Thing[5] / 1.5, Thing[6] / 1.5, 0, "Normal", "", 1)
5410
                  end
5411
                end
5412
                ref = CFuncs.Part.Create(workspace, "Neon", 0, 1, BrickColor.new("Pastel blue-green"), "Reference", Vector3.new())
5413
                ref.Anchored = true
5414
                ref.CFrame = CFrame.new(pos)
5415
                Effects.Sphere.Create(Torso.BrickColor, CFrame.new(pos), 5, 5, 5, 1, 1, 1, 0.07)
5416
                game:GetService("Debris"):AddItem(ref, 1)
5417
              end
5418
              if Thing[3] <= 0 then
5419
                table.remove(Effects, e)
5420
              end
5421
            end
5422
            if Thing[2] == "FireWave" then
5423
              if Thing[3] <= Thing[4] then
5424
                Thing[1].CFrame = Thing[1].CFrame * CFrame.fromEulerAnglesXYZ(0, 1, 0)
5425
                Thing[3] = Thing[3] + 1
5426
                Thing[6].Scale = Thing[6].Scale + Vector3.new(Thing[5], 0, Thing[5])
5427
              else
5428
                Part.Parent = nil
5429
                table.remove(Effects, e)
5430
              end
5431
            end
5432
            if Thing[2] ~= "Shoot" and Thing[2] ~= "Wave" and Thing[2] ~= "FireWave" then
5433
              if Thing[1].Transparency <= 1 then
5434
                if Thing[2] == "Block1" then
5435
                  Thing[1].CFrame = Thing[1].CFrame * CFrame.fromEulerAnglesXYZ(math.random(-50, 50), math.random(-50, 50), math.random(-50, 50))
5436
                  Mesh = Thing[7]
5437
                  Mesh.Scale = Mesh.Scale + Vector3.new(Thing[4], Thing[5], Thing[6])
5438
                  Thing[1].Transparency = Thing[1].Transparency + Thing[3]
5439
                elseif Thing[2] == "Block2" then
5440
                  Thing[1].CFrame = Thing[1].CFrame
5441
                  Mesh = Thing[7]
5442
                  Mesh.Scale = Mesh.Scale + Vector3.new(Thing[4], Thing[5], Thing[6])
5443
                  Thing[1].Transparency = Thing[1].Transparency + Thing[3]
5444
                elseif Thing[2] == "Fire" then
5445
                  Thing[1].CFrame = CFrame.new(Thing[1].Position) + Vector3.new(0, 0.2, 0)
5446
                  Thing[1].CFrame = Thing[1].CFrame * CFrame.fromEulerAnglesXYZ(math.random(-50, 50), math.random(-50, 50), math.random(-50, 50))
5447
                  Thing[1].Transparency = Thing[1].Transparency + Thing[3]
5448
                elseif Thing[2] == "Cylinder" then
5449
                  Mesh = Thing[7]
5450
                  Mesh.Scale = Mesh.Scale + Vector3.new(Thing[4], Thing[5], Thing[6])
5451
                  Thing[1].Transparency = Thing[1].Transparency + Thing[3]
5452
                elseif Thing[2] == "Blood" then
5453
                  Mesh = Thing[7]
5454
                  Thing[1].CFrame = Thing[1].CFrame * CFrame.new(0, 0.5, 0)
5455
                  Mesh.Scale = Mesh.Scale + Vector3.new(Thing[4], Thing[5], Thing[6])
5456
                  Thing[1].Transparency = Thing[1].Transparency + Thing[3]
5457
                elseif Thing[2] == "Elec" then
5458
                  Thing[1].Size = Thing[1].Size + Vector3.new(Thing[7], Thing[8], Thing[9])
5459
                  Thing[1].Transparency = Thing[1].Transparency + Thing[3]
5460
                elseif Thing[2] == "Disappear" then
5461
                  Thing[1].Transparency = Thing[1].Transparency + Thing[3]
5462
                elseif Thing[2] == "Shatter" then
5463
                  Thing[1].Transparency = Thing[1].Transparency + Thing[3]
5464
                  Thing[4] = Thing[4] * CFrame.new(0, Thing[7], 0)
5465
                  Thing[1].CFrame = Thing[4] * CFrame.fromEulerAnglesXYZ(Thing[6], 0, 0)
5466
                  Thing[6] = Thing[6] + Thing[5]
5467
                end
5468
              else
5469
                Part.Parent = nil
5470
                table.remove(Effects, e)
5471
              end
5472
            end
5473
          end
5474
        end
5475
      end
5476
    end
5477
  end