Advertisement
sIendytubble

old roblox script

Apr 29th, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 61.01 KB | None | 0 0
  1. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  2. local RealPlayer = Player
  3. local a=RealPlayer;char=a.Character;local b=Instance.new("RemoteEvent")b.Name="UserInput_Event"local function c()local d={_fakeEvent=true,Functions={},Connect=function(self,e)table.insert(self.Functions,e)end}d.connect=d.Connect;return d end;local f={Target=nil,Hit=CFrame.new(),KeyUp=c(),KeyDown=c(),Button1Up=c(),Button1Down=c(),Button2Up=c(),Button2Down=c()}local g={InputBegan=c(),InputEnded=c()}local CAS={Actions={},BindAction=function(self,h,i,j,...)CAS.Actions[h]=i and{Name=h,Function=i,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function k(self,l,...)local d=f[l]if d and d._fakeEvent then for m,e in pairs(d.Functions)do e(...)end end end;f.TrigEvent=k;g.TrigEvent=k;b.OnServerEvent:Connect(function(n,o)if n~=a then return end;f.Target=o.Target;f.Hit=o.Hit;if not o.isMouse then local p=o.UserInputState==Enum.UserInputState.Begin;if o.UserInputType==Enum.UserInputType.MouseButton1 then return f:TrigEvent(p and"Button1Down"or"Button1Up")end;if o.UserInputType==Enum.UserInputType.MouseButton2 then return f:TrigEvent(p and"Button2Down"or"Button2Up")end;for m,d in pairs(CAS.Actions)do for m,q in pairs(d.Keys)do if q==o.KeyCode then d.Function(d.Name,o.UserInputState,o)end end end;f:TrigEvent(p and"KeyDown"or"KeyUp",o.KeyCode.Name:lower())g:TrigEvent(p and"InputBegan"or"InputEnded",o,false)end end)b.Parent=NLS([==[local a=game:GetService("Players").LocalPlayer;local b=script:WaitForChild("UserInput_Event")local c=a:GetMouse()local d=game:GetService("UserInputService")local e=function(f,g)if g then return end;b:FireServer({KeyCode=f.KeyCode,UserInputType=f.UserInputType,UserInputState=f.UserInputState,Hit=c.Hit,Target=c.Target})end;d.InputBegan:Connect(e)d.InputEnded:Connect(e)local h,i;while wait(1/30)do if h~=c.Hit or i~=c.Target then h,i=c.Hit,c.Target;b:FireServer({isMouse=true,Target=i,Hit=h})end end]==],Player.Character)local r=game;local s={__index=function(self,q)local t=rawget(self,"_RealService")if t then return typeof(t[q])=="function"and function(m,...)return t[q](t,...)end or t[q]end end,__newindex=function(self,q,u)local t=rawget(self,"_RealService")if t then t[q]=u end end}local function v(d,w)d._RealService=typeof(w)=="string"and r:GetService(w)or w;return setmetatable(d,s)end;local x={GetService=function(self,t)return rawget(self,t)or r:GetService(t)end,Players=v({LocalPlayer=v({GetMouse=function(self)return f end},Player)},"Players"),UserInputService=v(g,"UserInputService"),ContextActionService=v(CAS,"ContextActionService"),RunService=v({_btrs={},RenderStepped=r:GetService("RunService").Heartbeat,BindToRenderStep=function(self,h,m,i)self._btrs[h]=self.Heartbeat:Connect(i)end,UnbindFromRenderStep=function(self,h)self._btrs[h]:Disconnect()end},"RunService")}rawset(x.Players,"localPlayer",x.Players.LocalPlayer)x.service=x.GetService;v(x,game)game,owner=x,x.Players.LocalPlayer
  4. local plr = owner
  5. local char = plr.Character
  6. local head = char:WaitForChild("Head")
  7. local torso = char:WaitForChild("Torso")
  8. local lArm = char:WaitForChild("Left Arm")
  9. local rArm = char:WaitForChild("Right Arm")
  10. local lLeg = char:WaitForChild("Left Leg")
  11. local rLeg = char:WaitForChild("Right Leg")
  12. local humanoid = char:WaitForChild("Humanoid")
  13. --[[
  14. coroutine.resume(coroutine.create(function()
  15. end))
  16. --]]
  17. forcefield = Instance.new("ForceField",char)
  18. forcefield.Visible = false
  19. coroutine.resume(coroutine.create(function()
  20. wait(10)
  21. forcefield.Parent = nil
  22. end))
  23. NLS([[
  24. local plr = owner
  25. local mouse = plr:GetMouse()
  26. local char = plr.Character
  27. local head = char:WaitForChild("Head")
  28. local torso = char:WaitForChild("Torso")
  29. local lArm = char:WaitForChild("Left Arm")
  30. local rArm = char:WaitForChild("Right Arm")
  31. local lLeg = char:WaitForChild("Left Leg")
  32. local rLeg = char:WaitForChild("Right Leg")
  33. local humanoid = char:WaitForChild("Humanoid")
  34. local green_disk = Instance.new("Part",game.Workspace.CurrentCamera)
  35. green_disk.Shape = "Cylinder"
  36. green_disk.Size = Vector3.new(0.1,2,2)
  37. green_disk.BrickColor = BrickColor.new("Lime green")
  38. green_disk.Material = "SmoothPlastic"
  39. green_disk.CanCollide = false
  40. green_disk.Anchored = true
  41. green_disk.CFrame = green_disk.CFrame * CFrame.Angles(0,math.rad(180),0)
  42. greendiskenabled = true
  43. local RS = game:GetService("RunService").RenderStepped
  44. RS:Connect(function()
  45. if mouse.Target ~= green_disk and greendiskenabled == true then
  46. green_disk.Position = mouse.hit.p
  47. green_disk.Orientation = Vector3.new(0, 0, -90)
  48. end
  49. if mouse.Target then
  50. green_disk.Transparency = 0
  51. else
  52. green_disk.Transparency = 1
  53. end
  54. end)
  55. mouse.Button1Down:Connect(function()
  56. if not char:FindFirstChildOfClass('Tool') and green_disk.Transparency == 0 then
  57. humanoid:MoveTo(green_disk.Position)
  58. greendiskenabled = false
  59. humanoid.MoveToFinished:Connect(function()
  60. greendiskenabled = true
  61. end)
  62. end
  63. end)
  64. humanoid.Died:Connect(function()
  65. green_disk:Destroy()
  66. end)
  67. ]], char)
  68. for i,v in pairs(char:GetChildren()) do
  69. if v.ClassName == "Part" then
  70. SelectionBox0 = Instance.new("SelectionBox",v)
  71. SelectionBox1 = Instance.new("SelectionBox",v)
  72. SelectionBox2 = Instance.new("SelectionBox",v)
  73. SelectionBox0.Name = "SelectionBox1"
  74. SelectionBox0.Color = BrickColor.new("Really blue")
  75. SelectionBox0.Transparency = 1
  76. SelectionBox0.Color3 = Color3.new(0, 0, 1)
  77. SelectionBox0.Adornee = v
  78. SelectionBox1.Name = "SelectionBox2"
  79. SelectionBox1.Color = BrickColor.new("Bright violet")
  80. SelectionBox1.Transparency = 0.20000000298023
  81. SelectionBox1.Color3 = Color3.new(0.419608, 0.196078, 0.486275)
  82. SelectionBox1.Adornee = v
  83. SelectionBox2.Name = "SelectionBox3"
  84. SelectionBox2.Color = BrickColor.new("Really red")
  85. SelectionBox2.Transparency = 0.80000001192093
  86. SelectionBox2.Color3 = Color3.new(1, 0, 0)
  87. SelectionBox2.Adornee = v
  88. print(SelectionBox0)
  89. print(SelectionBox1)
  90. print(SelectionBox2)
  91. local sb1 = SelectionBox0
  92. local sb2 = SelectionBox2
  93. local sb3 = SelectionBox1
  94. coroutine.resume(coroutine.create(function()
  95. while true do
  96. sb1.Transparency = .1
  97. sb2.Transparency = .9
  98. wait()
  99. sb1.Transparency = .2
  100. sb2.Transparency = .8
  101. wait()
  102. sb1.Transparency = .3
  103. sb2.Transparency = .7
  104. wait()
  105. sb1.Transparency = .4
  106. sb2.Transparency = .6
  107. wait()
  108. sb1.Transparency = .5
  109. sb2.Transparency = .5
  110. wait()
  111. sb1.Transparency = .6
  112. sb2.Transparency = .4
  113. wait()
  114. sb1.Transparency = .7
  115. sb2.Transparency = .3
  116. wait()
  117. sb1.Transparency = .8
  118. sb2.Transparency = .2
  119. wait()
  120. sb1.Transparency = .9
  121. sb2.Transparency = .1
  122. wait()
  123. sb1.Transparency = 1
  124. sb2.Transparency = 0
  125. wait()
  126. sb2.Transparency = .1
  127. sb3.Transparency = .9
  128. wait()
  129. sb2.Transparency = .2
  130. sb3.Transparency = .8
  131. wait()
  132. sb2.Transparency = .3
  133. sb3.Transparency = .7
  134. wait()
  135. sb2.Transparency = .4
  136. sb3.Transparency = .6
  137. wait()
  138. sb2.Transparency = .5
  139. sb3.Transparency = .5
  140. wait()
  141. sb2.Transparency = .6
  142. sb3.Transparency = .4
  143. wait()
  144. sb2.Transparency = .7
  145. sb3.Transparency = .3
  146. wait()
  147. sb2.Transparency = .8
  148. sb3.Transparency = .2
  149. wait()
  150. sb2.Transparency = .9
  151. sb3.Transparency = .1
  152. wait()
  153. sb2.Transparency = 1
  154. sb3.Transparency = 0
  155. wait()
  156. sb3.Transparency = .1
  157. sb1.Transparency = .9
  158. wait()
  159. sb3.Transparency = .2
  160. sb1.Transparency = .8
  161. wait()
  162. sb3.Transparency = .3
  163. sb1.Transparency = .7
  164. wait()
  165. sb3.Transparency = .4
  166. sb1.Transparency = .6
  167. wait()
  168. sb3.Transparency = .5
  169. sb1.Transparency = .5
  170. wait()
  171. sb3.Transparency = .6
  172. sb1.Transparency = .4
  173. wait()
  174. sb3.Transparency = .7
  175. sb1.Transparency = .3
  176. wait()
  177. sb3.Transparency = .8
  178. sb1.Transparency = .2
  179. wait()
  180. sb3.Transparency = .9
  181. sb1.Transparency = .1
  182. wait()
  183. sb3.Transparency = 1
  184. sb1.Transparency = 0
  185. end
  186. end))
  187. coroutine.resume(coroutine.create(function()
  188. wait(10)
  189. sb1.Parent = nil
  190. sb2.Parent = nil
  191. sb3.Parent = nil
  192. end))
  193. end
  194. end
  195. local face = head:FindFirstChildWhichIsA("Decal")
  196. local humanoid = char:FindFirstChildWhichIsA("Humanoid")
  197. local rootpart = char:WaitForChild("HumanoidRootPart")
  198. local bodycolors = char:WaitForChild("Body Colors")
  199. if face then
  200. face.Texture = "rbxassetid://2536856055"
  201. end
  202. if bodycolors then
  203. ForceColors = Instance.new("BoolValue",bodycolors)
  204. ForceColors.Name = "ForceColors"
  205. ForceColors.Value = false
  206. else
  207. print(bodycolors)
  208. end
  209. for _,charactermesh in pairs(char:GetChildren()) do
  210. if charactermesh.ClassName == "CharacterMesh" then
  211. charactermesh.Parent = nil
  212. end
  213. end
  214. DropWeapon = Instance.new("BoolValue",char)
  215. DropWeapon.Name = "DropWeapon"
  216. DropWeapon.Value = true
  217. Force_Hat = Instance.new("IntValue",char)
  218. Force_Hat.Name = "Force_Hat"
  219. Force_Hat.Value = 0
  220. Force_Pants = Instance.new("IntValue",char)
  221. Force_Pants.Name = "Force_Pants"
  222. Force_Pants.Value = 0
  223. Force_Shirt = Instance.new("IntValue",char)
  224. Force_Shirt.Name = "Force_Shirt"
  225. Force_Shirt.Value = 0
  226. Force_Weapon = Instance.new("IntValue",char)
  227. Force_Weapon.Name = "Force_Weapon"
  228. Force_Weapon.Value = 0
  229. IgnoreCombatFF = Instance.new("BoolValue",char)
  230. IgnoreCombatFF.Name = "IgnoreCombatFF"
  231. IgnoreCombatFF.Value = true
  232. IsAPlayer = Instance.new("CFrameValue",char)
  233. IsAPlayer.Name = "IsAPlayer"
  234. IsOnTeam = Instance.new("BoolValue",char)
  235. IsOnTeam.Name = "IsOnTeam"
  236. IsOnTeam.Value = false
  237. ShowTag = Instance.new("BoolValue",IsOnTeam)
  238. ShowTag.Name = "ShowTag"
  239. ShowTag.Value = false
  240. Team = Instance.new("BrickColorValue",IsOnTeam)
  241. Team.Name = "Team"
  242. Team.Value = BrickColor.new("Really black")
  243. PathTo = Instance.new("Vector3Value",char)
  244. PathTo.Name = "PathTo"
  245. PathTo.Value = Vector3.new(0,0,0)
  246. PrintMap = Instance.new("BoolValue",char)
  247. PrintMap.Name = "PrintMap"
  248. PrintMap.Value = false
  249. Respawn = Instance.new("BoolValue",char)
  250. Respawn.Name = "Respawn"
  251. Respawn.Value = false
  252. Wander = Instance.new("BoolValue",char)
  253. Wander.Name = "Wander"
  254. Wander.Value = false
  255. local CL_LeftArm = Instance.new("CharacterMesh",char)
  256. local CL_LeftLeg = Instance.new("CharacterMesh",char)
  257. local CL_RightArm = Instance.new("CharacterMesh",char)
  258. local CL_RightLeg = Instance.new("CharacterMesh",char)
  259. local CL_Torso = Instance.new("CharacterMesh",char)
  260. CL_LeftArm.BodyPart = Enum.BodyPart.LeftArm
  261. CL_LeftLeg.BodyPart = Enum.BodyPart.LeftLeg
  262. CL_RightArm.BodyPart = Enum.BodyPart.RightArm
  263. CL_RightLeg.BodyPart = Enum.BodyPart.RightLeg
  264. CL_Torso.BodyPart = Enum.BodyPart.Torso
  265. CL_LeftArm.MeshId = "1112256772"
  266. CL_LeftLeg.MeshId = "1112275294"
  267. CL_RightArm.MeshId = "1112244824"
  268. CL_RightLeg.MeshId = "1112267576"
  269. CL_Torso.MeshId = "1112228624"
  270. CL_LeftArm.Name = "CL_LeftArm"
  271. CL_LeftLeg.Name = "CL_LeftLeg"
  272. CL_RightArm.Name = "CL_RightArm"
  273. CL_RightLeg.Name = "CL_RightLeg"
  274. CL_Torso.Name = "CL_Torso"
  275. --cancel out the default R6 animations and then replace them with the old ones
  276. AnimationTracks = humanoid:GetPlayingAnimationTracks()
  277. for i, track in pairs (AnimationTracks) do
  278. track:Stop()
  279. end
  280. local AnimationTracks = humanoid:GetPlayingAnimationTracks()
  281. -- remove the sounds in the HumanoidRootPart if there any
  282. for _,sound in pairs(rootpart:GetChildren()) do
  283. if sound.ClassName == "Sound" then
  284. sound.Parent = nil
  285. end
  286. end
  287. -- just in case they changed sounds into the head
  288. for _,sound in pairs(head:GetChildren()) do
  289. if sound.ClassName == "Sound" then
  290. sound.Parent = nil
  291. end
  292. end
  293. -- animations --
  294. Delay(0, function() --Vanilla Sound
  295. function waitForChild(parent, childName)
  296. local child = parent:findFirstChild(childName)
  297. if child then return child end
  298. while true do
  299. child = parent.ChildAdded:wait()
  300. if child.Name==childName then return child end
  301. end
  302. end
  303. function newSound(id)
  304. local sound = Instance.new("Sound")
  305. sound.SoundId = id
  306. sound.archivable = false
  307. sound.Parent = char.Head
  308. return sound
  309. end
  310. local sDied = newSound("rbxasset://sounds/uuhhh.wav")
  311. local sFallingDown = newSound("rbxasset://sounds/splat.wav")
  312. local sFreeFalling = newSound("rbxasset://sounds/swoosh.wav")
  313. local sGettingUp = newSound("rbxasset://sounds/hit.wav")
  314. local sJumping = newSound("rbxasset://sounds/button.wav")
  315. local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3")
  316. sRunning.Looped = true
  317. local Figure = char
  318. local Head = waitForChild(Figure, "Head")
  319. local Humanoid = waitForChild(Figure, "Humanoid")
  320. function onDied()
  321. sDied:Play()
  322. end
  323. function onState(state, sound)
  324. if state then
  325. sound:Play()
  326. else
  327. sound:Pause()
  328. end
  329. end
  330. function onRunning(speed)
  331. if speed>0 then
  332. sRunning:Play()
  333. else
  334. sRunning:Pause()
  335. end
  336. end
  337. Humanoid.Died:connect(onDied)
  338. Humanoid.Running:connect(onRunning)
  339. Humanoid.Jumping:connect(function(state) onState(state, sJumping) end)
  340. Humanoid.GettingUp:connect(function(state) onState(state, sGettingUp) end)
  341. Humanoid.FreeFalling:connect(function(state) onState(state, sFreeFalling) end)
  342. Humanoid.FallingDown:connect(function(state) onState(state, sFallingDown) end)
  343. end)
  344. Delay(0, function() --Vanilla Health
  345. function waitForChild(parent, childName)
  346. local child = parent:findFirstChild(childName)
  347. if child then return child end
  348. while true do
  349. child = parent.ChildAdded:wait()
  350. if child.Name==childName then return child end
  351. end
  352. end
  353. local Figure = char
  354. local Humanoid = waitForChild(Figure, "Humanoid")
  355. local regening = false
  356. function regenHealth()
  357. if regening then return end
  358. regening = true
  359. while Humanoid.Health < Humanoid.MaxHealth do
  360. local s = wait(1)
  361. local health = Humanoid.Health
  362. if health > 0 and health < Humanoid.MaxHealth then
  363. local newHealthDelta = 0.01 * s * Humanoid.MaxHealth
  364. health = health + newHealthDelta
  365. Humanoid.Health = math.min(health,Humanoid.MaxHealth)
  366. end
  367. end
  368. if Humanoid.Health > Humanoid.MaxHealth then
  369. Humanoid.Health = Humanoid.MaxHealth
  370. end
  371. regening = false
  372. end
  373. Humanoid.HealthChanged:connect(regenHealth)
  374. end)
  375. Delay(0, function() --Vanilla Animate, Multiple Additions
  376. function waitForChild(parent, childName)
  377. local child = parent:findFirstChild(childName)
  378. if child then return child end
  379. while true do
  380. child = parent.ChildAdded:wait()
  381. if child.Name==childName then return child end
  382. end
  383. end
  384. local Figure = char
  385. --local Clone = Figure:Clone()
  386. local Torso = waitForChild(Figure, "Torso")
  387. local Joints = Torso:GetChildren()
  388. for All = 1, #Joints do
  389. if Joints.className == "Motor" or Joints.className == "Motor6D" then
  390. Joints[All]:Remove()
  391. end
  392. end
  393. local RightShoulder = Instance.new("Motor")
  394. local LeftShoulder = Instance.new("Motor")
  395. local RightHip = Instance.new("Motor")
  396. local LeftHip = Instance.new("Motor")
  397. local Neck = Instance.new("Motor")
  398. local Humanoid = waitForChild(Figure, "Humanoid")
  399. ZStat = 1
  400. ZStat2 = 0
  401. local pose = "Standing"
  402. RightShoulder.Part0 = Torso
  403. RightShoulder.Part1 = Figure["Right Arm"]
  404. RightShoulder.MaxVelocity = 0.15
  405. RightShoulder.Name = "Right Shoulder"
  406. RightShoulder.C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  407. RightShoulder.C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  408. RightShoulder.Parent = Torso
  409. LeftShoulder.Part0 = Torso
  410. LeftShoulder.Part1 = Figure["Left Arm"]
  411. LeftShoulder.MaxVelocity = 0.15
  412. LeftShoulder.Name = "Left Shoulder"
  413. LeftShoulder.C0 = CFrame.new(-1, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  414. LeftShoulder.C1 = CFrame.new(0.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  415. LeftShoulder.Parent = Torso
  416. RightHip.Part0 = Torso
  417. RightHip.Part1 = Figure["Right Leg"]
  418. RightHip.MaxVelocity = 0.1
  419. RightHip.Name = "Right Hip"
  420. RightHip.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  421. RightHip.C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  422. RightHip.Parent = Torso
  423. LeftHip.Part0 = Torso
  424. LeftHip.Part1 = Figure["Left Leg"]
  425. LeftHip.MaxVelocity = 0.1
  426. LeftHip.Name = "Left Hip"
  427. LeftHip.C0 = CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  428. LeftHip.C1 = CFrame.new(-0.5, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  429. LeftHip.Parent = Torso
  430. Neck.Part0 = Torso
  431. Neck.Part1 = Figure["Head"]
  432. Neck.MaxVelocity = 0.1
  433. Neck.Name = "Neck"
  434. Neck.C0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  435. Neck.C1 = CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  436. Neck.Parent = Torso
  437. local toolAnim = "None"
  438. local toolAnimTime = 0
  439. SpawnModel = Instance.new("Model")
  440. function onRunning(speed)
  441. if speed>0 then
  442. pose = "Running"
  443. else
  444. pose = "Standing"
  445. end
  446. end
  447. function CheckTag(Tag)
  448. if char:FindFirstChild("IsLocalEnemy") == nil and char:FindFirstChild("IsAZombie") == nil and Tag.ClassName == "ObjectValue" and Tag.Value ~= nil and Tag.Value.ClassName == "Player" and Tag.Value.Character ~= nil then
  449. if Tag.Value.Character:FindFirstChild("IsLocalEnemy") == nil then
  450. if (char.IsOnTeam.Value == true and IsInCombat == false and char.IsOnTeam.Team.Value == Tag.Value.TeamColor) or char.IsOnTeam.Value == false then
  451. local Tag2 = Instance.new("CFrameValue", Tag.Value.Character)
  452. Tag2.Name = "IsLocalEnemy"
  453. print(Tag.Value.Character.Name .." Has Become An Outlaw")
  454. end
  455. end
  456. if Tag.Value.Character:FindFirstChild("Loc" ..char.Name) ~= nil then
  457. Tag.Value.Character:FindFirstChild("Loc" ..char.Name):Remove()
  458. end
  459. local Found = Instance.new("CFrameValue", Tag.Value.Character)
  460. Found.Name = "Loc" ..char.Name
  461. game:GetService("Debris"):AddItem(Found, 3)
  462. elseif char:FindFirstChild("IsLocalEnemy") == nil and char:FindFirstChild("IsAZombie") == nil and Tag.ClassName == "StringValue" and game.Players:FindFirstChild(Tag.Value) ~= nil and game.Players[Tag.Value].Character ~= nil then
  463. if game.Players[Tag.Value].Character:FindFirstChild("IsLocalEnemy") == nil then
  464. if (char.IsOnTeam.Value == true and IsInCombat == false and char.IsOnTeam.Team.Value == game.Players[Tag.Value].TeamColor) or char.IsOnTeam.Value == false then
  465. local Tag2 = Instance.new("CFrameValue", game.Players[Tag.Value].Character)
  466. Tag2.Name = "IsLocalEnemy"
  467. print(Tag.Value .." Has Become An Outlaw")
  468. end
  469. end
  470. if game.Players[Tag.Value].Character:FindFirstChild("Loc" ..char.Name) ~= nil then
  471. game.Players[Tag.Value].Character:FindFirstChild("Loc" ..char.Name):Remove()
  472. end
  473. local Found = Instance.new("CFrameValue", game.Players[Tag.Value].Character)
  474. Found.Name = "Loc" ..char.Name
  475. game:GetService("Debris"):AddItem(Found, 3)
  476. elseif char:FindFirstChild("IsLocalEnemy") == nil and char:FindFirstChild("IsAZombie") == nil and Tag.ClassName == "StringValue" and game.Workspace:FindFirstChild(Tag.Value) ~= nil then
  477. if game.Workspace[Tag.Value]:FindFirstChild("IsLocalEnemy") == nil then
  478. if (char.IsOnTeam.Value == true and IsInCombat == false and Workspace[Tag.Value].IsOnTeam.Value == true and char.IsOnTeam.Team.Value == Workspace[Tag.Value].IsOnTeam.Team.Value) or char.IsOnTeam.Value == false or Workspace[Tag.Value].IsOnTeam.Value == false then
  479. local Tag2 = Instance.new("CFrameValue", game.Workspace[Tag.Value])
  480. Tag2.Name = "IsLocalEnemy"
  481. print(Tag.Value .." Has Become An Outlaw")
  482. end
  483. end
  484. if game.Workspace[Tag.Value]:FindFirstChild("Loc" ..char.Name) ~= nil then
  485. game.Workspace[Tag.Value]:FindFirstChild("Loc" ..char.Name):Remove()
  486. end
  487. local Found = Instance.new("CFrameValue", game.Workspace[Tag.Value])
  488. Found.Name = "Loc" ..char.Name
  489. game:GetService("Debris"):AddItem(Found, 3)
  490. elseif (char:FindFirstChild("IsLocalEnemy") ~= nil or char:FindFirstChild("IsAZombie") ~= nil) and Tag.ClassName == "ObjectValue" and Tag.Value ~= nil and Tag.Value.ClassName == "Player" and Tag.Value.Character ~= nil then
  491. local Found = Instance.new("CFrameValue", Tag.Value.Character)
  492. Found.Name = "Loc" ..char.Name
  493. game:GetService("Debris"):AddItem(Found, 3)
  494. elseif (char:FindFirstChild("IsLocalEnemy") ~= nil or char:FindFirstChild("IsAZombie") ~= nil) and Tag.ClassName == "StringValue" and game.Workspace:FindFirstChild(Tag.Value) ~= nil then
  495. local Found = Instance.new("CFrameValue", game.Workspace[Tag.Value])
  496. Found.Name = "Loc" ..char.Name
  497. game:GetService("Debris"):AddItem(Found, 3)
  498. end
  499. end
  500. function CheckSpawns(Object)
  501. local Parts = Object:GetChildren()
  502. for Check = 1, #Parts do
  503. if Parts[Check].className == "SpawnLocation" then
  504. local I = Instance.new("Vector3Value", SpawnModel)
  505. I.Value = Parts[Check].Position
  506. end
  507. CheckSpawns(Parts[Check])
  508. end
  509. end
  510. function onDied()
  511. pose = "Dead"
  512. Delay(5, function()
  513. if char.Respawn.Value == true then
  514. CheckSpawns(Workspace)
  515. local Spawn = SpawnModel:GetChildren()
  516. --Clone.Parent = game.Workspace
  517. if #Spawn > 0 then
  518. Spawn = Spawn[math.random(1, #Spawn)].Value
  519. --Clone:MoveTo(Spawn)
  520. else
  521. --Clone:MoveTo(Vector3.new(0, 50, 0))
  522. end
  523. end
  524. Figure:Remove()
  525. return
  526. end)
  527. end
  528. function onJumping()
  529. pose = "Jumping"
  530. end
  531. function onClimbing()
  532. pose = "Climbing"
  533. end
  534. function onGettingUp()
  535. pose = "GettingUp"
  536. end
  537. function onFreeFall()
  538. pose = "FreeFall"
  539. end
  540. function onFallingDown()
  541. pose = "FallingDown"
  542. end
  543. function onSeated()
  544. pose = "Seated"
  545. end
  546. function onPlatformStanding()
  547. pose = "PlatformStanding"
  548. end
  549. function moveJump()
  550. RightShoulder.MaxVelocity = 0.5
  551. LeftShoulder.MaxVelocity = 0.5
  552. RightShoulder.DesiredAngle = (3.14/ZStat)
  553. LeftShoulder.DesiredAngle = (-3.14/ZStat)
  554. RightHip.DesiredAngle = (0)
  555. LeftHip.DesiredAngle = (0)
  556. end
  557. function moveFreeFall()
  558. RightShoulder.MaxVelocity = 0.5
  559. LeftShoulder.MaxVelocity = 0.5
  560. RightShoulder.DesiredAngle = (3.14/ZStat)
  561. LeftShoulder.DesiredAngle = (-3.14/ZStat)
  562. RightHip.DesiredAngle = (0)
  563. LeftHip.DesiredAngle = (0)
  564. end
  565. function moveSit()
  566. RightShoulder.MaxVelocity = 0.15
  567. LeftShoulder.MaxVelocity = 0.15
  568. RightShoulder.DesiredAngle = (3.14 /2)
  569. LeftShoulder.DesiredAngle = (-3.14 /2)
  570. RightHip.DesiredAngle = (3.14 /2)
  571. LeftHip.DesiredAngle = (-3.14 /2)
  572. end
  573. function getTool()
  574. for _, kid in ipairs(Figure:GetChildren()) do
  575. if kid.className == "Tool" then return kid end
  576. end
  577. return nil
  578. end
  579. function getToolAnim(tool)
  580. for _, c in ipairs(tool:GetChildren()) do
  581. if c.Name == "toolanim" and c.className == "StringValue" then
  582. return c
  583. end
  584. end
  585. return nil
  586. end
  587. function animateTool()
  588. if (toolAnim == "None") then
  589. RightShoulder.DesiredAngle = (1.57)
  590. return
  591. end
  592. if (toolAnim == "Slash") then
  593. RightShoulder.MaxVelocity = 0.5
  594. RightShoulder.DesiredAngle = (0)
  595. return
  596. end
  597. if (toolAnim == "Lunge") then
  598. RightShoulder.MaxVelocity = 0.5
  599. LeftShoulder.MaxVelocity = 0.5
  600. RightHip.MaxVelocity = 0.5
  601. LeftHip.MaxVelocity = 0.5
  602. RightShoulder.DesiredAngle = (1.57)
  603. LeftShoulder.DesiredAngle = (1.0)
  604. RightHip.DesiredAngle = (1.57)
  605. LeftHip.DesiredAngle = (1.0)
  606. return
  607. end
  608. end
  609. function move(time)
  610. local amplitude
  611. local frequency
  612. if (pose == "Jumping") then
  613. moveJump()
  614. return
  615. end
  616. if (pose == "FreeFall") then
  617. moveFreeFall()
  618. return
  619. end
  620. if (pose == "Seated") then
  621. moveSit()
  622. return
  623. end
  624. local climbFudge = 0
  625. if (pose == "Running") then
  626. RightShoulder.MaxVelocity = 0.15
  627. LeftShoulder.MaxVelocity = 0.15
  628. amplitude = 1
  629. frequency = 9
  630. elseif (pose == "Climbing") then
  631. RightShoulder.MaxVelocity = 0.5
  632. LeftShoulder.MaxVelocity = 0.5
  633. amplitude = 1
  634. frequency = 9
  635. climbFudge = 3.14
  636. else
  637. amplitude = 0.1
  638. frequency = 1
  639. end
  640. desiredAngle = amplitude * math.sin(time*frequency)
  641. RightShoulder.DesiredAngle = (desiredAngle + climbFudge) + ZStat2
  642. LeftShoulder.DesiredAngle = (desiredAngle - climbFudge) -ZStat2
  643. RightHip.DesiredAngle = (-desiredAngle)
  644. LeftHip.DesiredAngle = (-desiredAngle)
  645. local tool = getTool()
  646. if tool then
  647. animStringValueObject = getToolAnim(tool)
  648. if animStringValueObject then
  649. toolAnim = animStringValueObject.Value
  650. animStringValueObject.Parent = nil
  651. toolAnimTime = time + .3
  652. end
  653. if time > toolAnimTime then
  654. toolAnimTime = 0
  655. toolAnim = "None"
  656. end
  657. animateTool()
  658. else
  659. toolAnim = "None"
  660. toolAnimTime = 0
  661. end
  662. end
  663. Humanoid.Died:connect(onDied)
  664. Humanoid.Running:connect(onRunning)
  665. Humanoid.Jumping:connect(onJumping)
  666. Humanoid.Climbing:connect(onClimbing)
  667. Humanoid.GettingUp:connect(onGettingUp)
  668. Humanoid.FreeFalling:connect(onFreeFall)
  669. Humanoid.FallingDown:connect(onFallingDown)
  670. Humanoid.Seated:connect(onSeated)
  671. Humanoid.PlatformStanding:connect(onPlatformStanding)
  672. Humanoid.ChildAdded:connect(CheckTag)
  673. OriginalTime = 0.1
  674. Time = OriginalTime
  675. while Figure.Parent~=nil do
  676. Time = Time + 0.1
  677. wait(OriginalTime)
  678. move(Time)
  679. end
  680. end)
  681. Delay(0, function() --lah30303's Pathing Script
  682. function CalcMoves(map, px, py, tx, ty)
  683. if map[ty][tx] ~= 0 then
  684. return nil
  685. end
  686. local openlist, closedlist, listk, closedk, tempH, tempG, xsize, ysize, curbase = {}, {}, 1, 0, math.abs(px - tx) + math.abs(py - ty), 0, #map[1], #map, {}
  687. openlist[1] = {x = px, y = py, g = 0, h = tempH, f = 0 + tempH ,par = 1}
  688. local nodenumber = 0
  689. while listk > 0 do
  690. nodenumber = nodenumber + 1
  691. if nodenumber / ScanSkip == math.floor(nodenumber / ScanSkip) then
  692. wait()
  693. if DebugPathing == true then
  694. print("Node", nodenumber)
  695. end
  696. end
  697. closedk = closedk + 1
  698. table.insert(closedlist, closedk, openlist[1])
  699. curbase = closedlist[closedk]
  700. if closedlist[closedk].x == tx and closedlist[closedk].y == ty then
  701. return closedlist
  702. end
  703. openlist[1] = openlist[listk]
  704. table.remove(openlist, listk)
  705. listk = listk - 1
  706. local v = 1
  707. while true do
  708. local u = v
  709. if 2 * u + 1 <= listk then
  710. if openlist[u].f >= openlist[2 * u].f then
  711. v = 2 * u
  712. end
  713. if openlist[v].f >= openlist[2 * u + 1].f then
  714. v = 2 * u + 1
  715. end
  716. elseif 2 * u <= listk then
  717. if openlist[u].f >= openlist[2 * u].f then
  718. v = 2 * u
  719. end
  720. end
  721. if u ~= v then
  722. local temp = openlist[u]
  723. openlist[u] = openlist[v]
  724. openlist[v] = temp
  725. else
  726. break
  727. end
  728. end
  729.  
  730. 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
  731. if closedk > 0 then
  732. for k = 1, closedk do
  733. for i, v in pairs(tocheck) do
  734. if closedlist[k].x == curbase.x + v[1] and closedlist[k].y == curbase.y + v[2] then
  735. tocheck[i] = nil
  736. end
  737. end
  738. end
  739. end
  740. for i, v in pairs(tocheck) do
  741. local a = curbase.x + v[1]
  742. local b = curbase.y + v[2]
  743. if a > xsize or a < 1 or b > ysize or b < 1 then
  744. tocheck[i] = nil
  745. end
  746. end
  747. for i, v in pairs(tocheck) do
  748. local a, b = curbase.x + v[1], curbase.y + v[2]
  749. if a <= xsize and a >= 1 and b <= ysize and b >= 1 and map[b][a] ~= 0 then
  750. tocheck[i] = nil
  751. end
  752. end
  753. tempG = curbase.g + 1
  754. tempDiagG = curbase.g + 1.4
  755. for k = 1, listk do
  756. for i, v in pairs(tocheck) do
  757. if openlist[k].x == curbase.x + v[1] and openlist[k].y == curbase.y + 1 and openlist[k].g > tempG then
  758. tempH = math.abs((curbase.x + v[1])-tx) + math.abs((curbase.y + v[1])-ty)
  759. table.insert(openlist, k, {x = curbase.x + v[1], y = curbase.y + v[2], g = tempG, h = tempH, f = tempG + tempH, par = closedk})
  760. local m = k
  761. while m ~= 1 do
  762. if openlist[m].f <= openlist[math.floor(m/2)].f then
  763. temp = openlist[math.floor(m/2)]
  764. openlist[math.floor(m/2)] = openlist[m]
  765. openlist[m] = temp
  766. m = math.floor(m/2)
  767. else
  768. break
  769. end
  770. tocheck[i] = nil
  771. end
  772. end
  773. end
  774. end
  775. for i, v in pairs(tocheck) do
  776. listk = listk + 1
  777. tempH = math.abs((curbase.x + v[1]) - tx) + math.abs((curbase.y + v[2]) - ty)
  778. table.insert(openlist, listk, {x = curbase.x + v[1], y = curbase.y + v[2], g = tempG, h = tempH, f = tempG+tempH, par = closedk})
  779. m = listk
  780. while m ~= 1 do
  781. if openlist[m].f <= openlist[math.floor(m/2)].f then
  782. temp = openlist[math.floor(m/2)]
  783. openlist[math.floor(m/2)] = openlist[m]
  784. openlist[m] = temp
  785. m = math.floor(m/2)
  786. else
  787. break
  788. end
  789. end
  790. end
  791. end
  792. return nil
  793. end
  794.  
  795.  
  796. function CalcPath(closedlist)
  797.  
  798. if closedlist == nil or table.getn(closedlist) == 1 then
  799. return nil
  800. end
  801. local path = {}
  802. local pathIndex = {}
  803. local last = table.getn(closedlist)
  804. table.insert(pathIndex,1,last)
  805.  
  806. local i = 1
  807. while pathIndex[i] > 1 do
  808. i = i + 1
  809. table.insert(pathIndex, i, closedlist[pathIndex[i - 1]].par)
  810. end
  811.  
  812. for n = table.getn(pathIndex) - 1, 1, -1 do
  813. table.insert(path, {x = closedlist[pathIndex[n]].x, y = closedlist[pathIndex[n]].y})
  814. end
  815.  
  816. closedlist = nil
  817. return path
  818. end
  819. end)
  820. Delay(0, function() --Main Artificial Intelligence Scripting/Path Grid Generator
  821. local Base
  822. if char:FindFirstChild("BASE") == nil then
  823. Base = Instance.new("Part")
  824. Base.Transparency = 1
  825. Base.TopSurface = "Smooth"
  826. Base.BottomSurface = "Smooth"
  827. Base.CanCollide = false
  828. Base.Anchored = true
  829. Base.Locked = true
  830. Base.BrickColor = BrickColor.new(0, 0, 0)
  831. Base.Name = "BASE"
  832. Base.CFrame = CFrame.new(Vector3.new(0, 0, 0))
  833. Base.Parent = char
  834. else
  835. Base = char.BASE
  836. Base.CFrame = CFrame.new(Vector3.new(0, 0, 0))
  837. end
  838. function Jump()
  839. --char.Humanoid.Jump = true
  840. end
  841. function Check(Hit)
  842. if Hit ~= nil and Hit.Parent ~= nil and Hit.Parent.Parent ~= nil then
  843. if Hit.Parent:FindFirstChild("Humanoid") == nil and Hit.Parent.Parent:FindFirstChild("Humanoid") == nil then
  844. Jump()
  845. end
  846. end
  847. end
  848. char.Torso.Touched:connect(Check)
  849. function Prep(Target, Current, Attempts)
  850. if Attempts == nil then
  851. Attempts = 1000
  852. end
  853. local Hit = false
  854. local Tag = Base:Clone()
  855. Tag.Position = Target
  856. Tag.Parent = char
  857. local TagRay = Ray.new(Tag.CFrame.p, (CFrame.new(Tag.CFrame.p - Vector3.new(0, 3, 0)).p - Tag.CFrame.p).Unit * 40)
  858. local TRHit, TRPos = game.Workspace:FindPartOnRay(TagRay, char)
  859. if TRHit ~= nil then
  860. Hit = true
  861. end
  862. if Tag.Parent ~= nil then
  863. Tag:Remove()
  864. end
  865. if Hit == false and Attempts > 0 and char.Wander.Value == true then
  866. Prep(char.Torso.Position + Vector3.new(math.random(-100, 100), 0, math.random(-100, 100)), Base, Attempts - 1)
  867. elseif char.Wander.Value == true then
  868. local TargetRay = Ray.new(char.Torso.CFrame.p, (CFrame.new(Target).p - char.Torso.CFrame.p).Unit * ((Target - char.Torso.Position).Magnitude - 3))
  869. local THit, TPos = game.Workspace:FindPartOnRay(TargetRay, char)
  870. local TrueTarget = char.Torso.Position
  871. if THit ~= nil then
  872. for HazardCheck = 1, math.floor((char.Torso.CFrame.p - TPos).Magnitude) do
  873. local TR2 = Ray.new(char.Torso.CFrame.p + (TPos - char.Torso.CFrame.p).Unit * HazardCheck, Vector3.new(0, -50, 0) + (TPos - char.Torso.CFrame.p).Unit * 3)
  874. local TH2, TP2 = game.Workspace:FindPartOnRay(TR2, char)
  875. if TH2 ~= nil and TH2.Name ~= "Lava" then
  876. TrueTarget = TP2
  877. else
  878. break
  879. end
  880. end
  881. else
  882. for HazardCheck = 1, math.floor((char.Torso.CFrame.p - Target).Magnitude) do
  883. local TR2 = Ray.new(char.Torso.CFrame.p + (Target - char.Torso.CFrame.p).Unit * HazardCheck, Vector3.new(0, -50, 0) + (TPos - char.Torso.CFrame.p).Unit * 3)
  884. local TH2, TP2 = game.Workspace:FindPartOnRay(TR2, char)
  885. if TH2 ~= nil and TH2.Name ~= "Lava" then
  886. TrueTarget = TP2
  887. else
  888. break
  889. end
  890. end
  891. end
  892. --char.Humanoid:MoveTo(TrueTarget, Current)
  893. end
  894. end
  895. function ZHit(Part)
  896. if char:FindFirstChild("IsAZombie") ~= nil and char.Humanoid.Health > 0 and Part ~= nil and Part.Parent ~= nil and Part.Parent:FindFirstChild("Humanoid") ~= nil and Part.Parent:FindFirstChild("IsAZombie") == nil then
  897. Part.Parent.Humanoid:TakeDamage(2)
  898. char.Humanoid.MaxHealth = char.Humanoid.MaxHealth + 1
  899. char.Humanoid:TakeDamage(-1)
  900. end
  901. end
  902. char["Right Arm"].Touched:connect(ZHit)
  903. char["Left Arm"].Touched:connect(ZHit)
  904. CurrentMap = {}
  905. MapMask = {}
  906. MapVar = {0, 0, 0, 0, 0}
  907. BlockScanned = 0
  908. ScanSkip = 5
  909. DebugPathing = true
  910. function GenerateMap(PathPos)
  911. CurrentMap = {}
  912. MapMask = {}
  913. MapVar = {0, 0, 0, 0, 0}
  914. BlockScanned = 0
  915. MapVariables = ScanParts(Workspace, 1)
  916. for MapX = 1, math.max(-MapVariables[1], MapVariables[2]) * 2 + 1 do
  917. CurrentMap[MapX] = {}
  918. for MapY = 1, math.max(-MapVariables[3], MapVariables[4]) * 2 + 1 do
  919. CurrentMap[MapX][MapY] = 0
  920. end
  921. end
  922. for MaskX = 1, #CurrentMap do
  923. MapMask[MaskX] = {}
  924. for MaskY = 1, #CurrentMap[MaskX] do
  925. MapMask[MaskX][MaskY] = {MapVariables[1] + MaskX - 0.5, MapVariables[1] + MaskY - 0.5}
  926. end
  927. end
  928. ScanParts(Workspace, 2, MapVariables)
  929. wait(1)
  930. if char.PrintMap.Value == true then
  931. print("Printing Map...")
  932. for ClearPrint = 1, 250 do
  933. wait()
  934. print()
  935. end
  936. for PrintX = 1, #CurrentMap do
  937. local PrintZ = ""
  938. for PrintY = 1, #CurrentMap[PrintX] do
  939. PrintZ = PrintZ ..CurrentMap[PrintX][PrintY]
  940. end
  941. print(PrintZ)
  942. wait(0.1)
  943. end
  944. end
  945. local MapCoords = {0, 0, 0, 0}
  946. local Distance = math.huge
  947. for MPX = 1, #CurrentMap do
  948. for MPY = 1, #CurrentMap[MPX] do
  949. if (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(char.Torso.Position.X, 0, char.Torso.Position.Z)).Magnitude < Distance then
  950. MapCoords = {MPX, MPY, 0, 0}
  951. Distance = (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(char.Torso.Position.X, 0, char.Torso.Position.Z)).Magnitude
  952. end
  953. end
  954. end
  955. local Distance = math.huge
  956. for MPX = 1, #CurrentMap do
  957. for MPY = 1, #CurrentMap[MPX] do
  958. if (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(char.PathTo.Value.X, 0, char.PathTo.Value.Z)).Magnitude < Distance then
  959. MapCoords = {MapCoords[1], MapCoords[2], math.min(MPX, #CurrentMap) - 1, math.min(MPY, #CurrentMap[1] - 1)}
  960. Distance = (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(char.PathTo.Value.X, 0, char.PathTo.Value.Z)).Magnitude
  961. end
  962. end
  963. end
  964. for i, v in pairs(CalcPath(CalcMoves(CurrentMap, MapCoords[1], MapCoords[2], MapCoords[3], MapCoords[4]))) do
  965. local Timer = 20
  966. local pX = v["x"]
  967. local pY = v["y"]
  968. local pTo = Vector3.new(MapMask[pX][pY][1], 0, MapMask[pX][pY][2])
  969. pTo = pTo + (pTo - Vector3.new(char.Torso.Position.X, 0, char.Torso.Position.Z)).Unit
  970. while (Vector3.new(char.Torso.Position.X, 0, char.Torso.Position.Z) - pTo).Magnitude > 2.5 and Timer > 0 do
  971. --char.Humanoid:MoveTo(pTo, Base)
  972. Timer = Timer - 1
  973. if Timer == 10 then
  974. --char.Humanoid.Jump = true
  975. end
  976. wait(0.1)
  977. end
  978. if Timer == 0 then
  979. if (Vector3.new(char.Torso.Position.X, 0, char.Torso.Position.Z) - pTo).Magnitude <= 5 then
  980. char.Torso.CFrame = char.Torso.CFrame + (pTo - Vector3.new(char.Torso.Position.X, 0, char.Torso.Position.Z)).Unit * (pTo - Vector3.new(char.Torso.Position.X, 0, char.Torso.Position.Z)).Magnitude
  981. else
  982. break
  983. end
  984. end
  985. end
  986. end
  987. function ScanParts(CurrentModel, CurrentStage, Variables)
  988. local X = CurrentModel:GetChildren()
  989. for I = 1, #X do
  990. if #X[I]:GetChildren() > 0 then
  991. ScanParts(X[I], 1, Variables)
  992. end
  993. 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
  994. BlockScanned = BlockScanned + 1
  995. if BlockScanned / ScanSkip == math.floor(BlockScanned / ScanSkip) then
  996. wait()
  997. if DebugPathing == true then
  998. print("Block", BlockScanned)
  999. end
  1000. end
  1001. if CurrentStage == 1 then
  1002. MapVar[1] = math.min(math.ceil(X[I].Position.X - X[I].Size.X / 2), MapVar[1])
  1003. MapVar[2] = math.max(math.floor(X[I].Position.X + X[I].Size.X / 2), MapVar[2])
  1004. MapVar[3] = math.min(math.ceil(X[I].Position.Z - X[I].Size.Z / 2), MapVar[3])
  1005. MapVar[4] = math.max(math.floor(X[I].Position.Z + X[I].Size.Z / 2), MapVar[4])
  1006. elseif CurrentStage == 2 and ((X[I].Position.Y + X[I].Size.Y / 2 > char.Torso.Position.Y + 2 and X[I].Position.Y - X[I].Size.Y / 2 < char.Torso.Position.Y + 2) or X[I].Position.Y + X[I].Size.Y / 2 < char.Torso.Position.Y - 8) then
  1007. local BlockStart = {X[I].Position.X - X[I].Size.X / 2, X[I].Position.Z - X[I].Size.Z / 2}
  1008. local BlockEnd = {X[I].Position.X + X[I].Size.X / 2, X[I].Position.Z + X[I].Size.Z / 2}
  1009. local BlockCoords = {0, 0, 0, 0}
  1010. local Distance = math.huge
  1011. for MPX = 1, #CurrentMap do
  1012. for MPY = 1, #CurrentMap[MPX] do
  1013. if (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(BlockStart[1], 0, BlockStart[2])).Magnitude < Distance then
  1014. BlockCoords = {MPX, MPY, 0, 0}
  1015. Distance = (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(BlockStart[1], 0, BlockStart[2])).Magnitude
  1016. end
  1017. end
  1018. end
  1019. local Distance = math.huge
  1020. for MPX = 1, #CurrentMap do
  1021. for MPY = 1, #CurrentMap[MPX] do
  1022. if (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(BlockEnd[1], 0, BlockEnd[2])).Magnitude < Distance then
  1023. BlockCoords = {BlockCoords[1], BlockCoords[2], MPX, MPY}
  1024. Distance = (Vector3.new(MapMask[MPX][MPY][1], 0, MapMask[MPX][MPY][2]) - Vector3.new(BlockEnd[1], 0, BlockEnd[2])).Magnitude
  1025. end
  1026. end
  1027. end
  1028. for XGrid = BlockCoords[2], BlockCoords[4] do
  1029. for YGrid = BlockCoords[1], BlockCoords[3] do
  1030. CurrentMap[XGrid][YGrid] = 1
  1031. end
  1032. end
  1033. end
  1034. end
  1035. end
  1036. if CurrentStage == 1 then
  1037. MapVar[5] = {MapVar[1] + MapVar[2] / 2, MapVar[3] + MapVar[4] / 2}
  1038. return MapVar
  1039. end
  1040. end
  1041. IsInCombat = false
  1042. while char.Humanoid.Health > 0 and char:FindFirstChild("IsAZombie") == nil do
  1043. local Distance = 100
  1044. local Target = nil
  1045. IsInCombat = false
  1046. local Players = Workspace:GetChildren()
  1047. for Check = 1, #Players do
  1048. if Players[Check] ~= char and ((Players[Check]:FindFirstChild("Humanoid") ~= nil and (Players[Check]:FindFirstChild("IsAZombie") ~= nil or Players[Check]:FindFirstChild("IsLocalEnemy") ~= nil or char:FindFirstChild("IsLocalEnemy") ~= nil or (char.IsOnTeam.Value == true and Players[Check]:FindFirstChild("IsOnTeam") ~= nil and Players[Check].IsOnTeam.Value == true and char.IsOnTeam.Team.Value ~= Players[Check].IsOnTeam.Team.Value) or (game.Players:GetPlayerFromCharacter(Players[Check]) ~= nil and char.IsOnTeam.Value == true and game.Players:GetPlayerFromCharacter(Players[Check]).Neutral == false and game.Players:GetPlayerFromCharacter(Players[Check]).TeamColor ~= char.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 - char.Torso.Position).Magnitude <= 100 then
  1049. local Ray = Ray.new(char.Torso.CFrame.p, (Players[Check].Torso.CFrame.p - char.Torso.CFrame.p).Unit * 100)
  1050. local Hit, Position = game.Workspace:FindPartOnRay(Ray, char)
  1051. 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
  1052. local TeamTag = nil
  1053. local Parts = Players[Check]:GetChildren()
  1054. for X = 1, #Parts do
  1055. if Parts[X].Name == "TeamLoc" then
  1056. if Parts[X].Value == char.IsOnTeam.Team.Value then
  1057. TeamTag = Parts[X]
  1058. end
  1059. end
  1060. end
  1061. if Players[Check]:FindFirstChild("Loc" ..char.Name) ~= nil or Parts[X] ~= nil or (Players[Check].Torso.Position - (char.Torso.Position + char.Torso.CFrame.lookVector * 50)).Magnitude <= 52 then
  1062. if char.IsOnTeam.Value == false then
  1063. if Players[Check]:FindFirstChild("Loc" ..char.Name) ~= nil then
  1064. Players[Check]:FindFirstChild("Loc" ..char.Name):Remove()
  1065. end
  1066. local Found = Instance.new("CFrameValue", Players[Check])
  1067. Found.Name = "Loc" ..char.Name
  1068. game:GetService("Debris"):AddItem(Found, 3)
  1069. else
  1070. if Parts[X] ~= nil then
  1071. Parts[X]:Remove()
  1072. end
  1073. local Found = Instance.new("BrickColorValue", Players[Check])
  1074. Found.Name = "TeamLoc"
  1075. Found.Value = char.IsOnTeam.Team.Value
  1076. game:GetService("Debris"):AddItem(Found, 3)
  1077. if Players[Check]:FindFirstChild("Loc" ..char.Name) ~= nil then
  1078. Players[Check]:FindFirstChild("Loc" ..char.Name):Remove()
  1079. end
  1080. local Found = Instance.new("CFrameValue", Players[Check])
  1081. Found.Name = "Loc" ..char.Name
  1082. game:GetService("Debris"):AddItem(Found, 3)
  1083. end
  1084. end
  1085. if Players[Check]:FindFirstChild("Loc" ..char.Name) ~= nil and (Players[Check].Torso.Position - char.Torso.Position).Magnitude <= Distance then
  1086. Target = Players[Check].Torso
  1087. Distance = (Target.Position - char.Torso.Position).Magnitude
  1088. end
  1089. end
  1090. end
  1091. end
  1092. if Target == nil then
  1093. local HasTool = false
  1094. local ToolCheck = char:GetChildren()
  1095. for Check = 1, #ToolCheck do
  1096. if ToolCheck[Check].ClassName == "Tool" then
  1097. HasTool = true
  1098. end
  1099. end
  1100. if HasTool == false then
  1101. Distance = 100
  1102. for Check = 1, #Players do
  1103. 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 - char.Torso.Position).Magnitude <= Distance then
  1104. local Ray = Ray.new(char.Torso.CFrame.p, (Players[Check].Handle.CFrame.p - char.Torso.CFrame.p).Unit * 100)
  1105. local Hit, Position = game.Workspace:FindPartOnRay(Ray, char)
  1106. if Hit ~= nil and Hit.Parent ~= nil and Hit.Parent == Players[Check] then
  1107. Distance = (Players[Check].Handle.Position - char.Torso.Position).Magnitude
  1108. Target = Players[Check]
  1109. end
  1110. end
  1111. end
  1112. if Target ~= nil and Target.ClassName == "Tool" then
  1113. if Distance <= 5 and HasTool == false then
  1114. Target.Parent = char
  1115. HasTool = true
  1116. else
  1117. Prep(Target.Handle.Position, Base)
  1118. end
  1119. else
  1120. for Check = 1, #Players do
  1121. if Players[Check].Name == "Crate" and Players[Check]:FindFirstChild("OpenCrate") ~= nil and Players[Check].OpenCrate.Value == false and (Players[Check].Position - char.Torso.Position).Magnitude <= Distance then
  1122. local Ray = Ray.new(char.Torso.CFrame.p, (Players[Check].CFrame.p - char.Torso.CFrame.p).Unit * 100)
  1123. local Hit, Position = game.Workspace:FindPartOnRay(Ray, char)
  1124. if Hit ~= nil and Hit == Players[Check] then
  1125. Target = Players[Check]
  1126. Distance = (Target.Position - char.Torso.Position).Magnitude
  1127. end
  1128. end
  1129. end
  1130. if Target ~= nil then
  1131. --char.Humanoid:MoveTo(Target.Position, Target)
  1132. if (Target.Position - char.Torso.Position).Magnitude <= 10 then
  1133. Target.OpenCrate.Value = true
  1134. end
  1135. else
  1136. local HasHat = false
  1137. local HatCheck = char:GetChildren()
  1138. for Check = 1, #HatCheck do
  1139. if ToolCheck[Check].ClassName == "Hat" then
  1140. HasHat = true
  1141. end
  1142. end
  1143. if HasHat == false then
  1144. Distance = 100
  1145. for Check = 1, #Players do
  1146. if Players[Check].ClassName == "Hat" and Players[Check]:FindFirstChild("Handle") ~= nil and (Players[Check].Handle.Position - char.Torso.Position).Magnitude <= Distance then
  1147. local Ray = Ray.new(char.Torso.CFrame.p, (Players[Check].Handle.CFrame.p - char.Torso.CFrame.p).Unit * 100)
  1148. local Hit, Position = game.Workspace:FindPartOnRay(Ray, char)
  1149. if Hit ~= nil and Hit.Parent ~= nil and Hit.Parent == Players[Check] then
  1150. Distance = (Players[Check].Handle.Position - char.Torso.Position).Magnitude
  1151. Target = Players[Check]
  1152. end
  1153. end
  1154. end
  1155. if Target ~= nil and Target.ClassName == "Hat" then
  1156. if Distance <= 5 and HasHat == false then
  1157. Target.Parent = char
  1158. HasHat = true
  1159. else
  1160. Prep(Target.Handle.Position, Base)
  1161. end
  1162. else
  1163. if char.Humanoid.PlatformStand == false and char.Humanoid.Sit == false then
  1164. if char.PathTo.Value ~= Vector3.new(0, 0, 0) then
  1165. GenerateMap(char.PathTo.Value)
  1166. char.PathTo.Value = Vector3.new(0, 0, 0)
  1167. elseif math.random(1, 10) == 1 and char.Wander.Value == true then
  1168. Prep(char.Torso.Position + Vector3.new(math.random(-100, 100), 0, math.random(-100, 100)), Base)
  1169. end
  1170. else
  1171. Jump()
  1172. end
  1173. end
  1174. end
  1175. end
  1176. end
  1177. else
  1178. if Target == nil then
  1179. local Distance = 80
  1180. local Players = Workspace:GetChildren()
  1181. for Check = 1, #Players do
  1182. if Players[Check]:FindFirstChild("Humanoid") ~= nil and Players[Check] ~= char 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 - char.Torso.Position).Magnitude <= Distance then
  1183. local Ray = Ray.new(char.Torso.CFrame.p, (Players[Check].Torso.CFrame.p - char.Torso.CFrame.p).Unit * 100)
  1184. local Hit, Position = game.Workspace:FindPartOnRay(Ray, char)
  1185. 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
  1186. Target = Players[Check].Torso
  1187. Distance = (Target.Position - char.Torso.Position).Magnitude
  1188. end
  1189. end
  1190. end
  1191. if Target ~= nil then
  1192. local Position = Target.Position + (char.Torso.Position - Target.Position).Unit * 10
  1193. Prep(Position, Base)
  1194. else
  1195. if char.Humanoid.PlatformStand == false and char.Humanoid.Sit == false then
  1196. if char.PathTo.Value ~= Vector3.new(0, 0, 0) then
  1197. GenerateMap(char.PathTo.Value)
  1198. char.PathTo.Value = Vector3.new(0, 0, 0)
  1199. elseif math.random(1, 10) == 1 and char.Wander.Value == true then
  1200. Prep(char.Torso.Position + Vector3.new(math.random(-100, 100), 0, math.random(-100, 100)), Base)
  1201. end
  1202. else
  1203. Jump()
  1204. end
  1205. end
  1206. else
  1207. if char.Humanoid.PlatformStand == false and char.Humanoid.Sit == false then
  1208. if char.PathTo.Value ~= Vector3.new(0, 0, 0) then
  1209. GenerateMap(char.PathTo.Value)
  1210. char.PathTo.Value = Vector3.new(0, 0, 0)
  1211. elseif math.random(1, 10) == 1 and char.Wander.Value == true then
  1212. Prep(char.Torso.Position + Vector3.new(math.random(-100, 100), 0, math.random(-100, 100)), Base)
  1213. end
  1214. else
  1215. Jump()
  1216. end
  1217. end
  1218. end
  1219. else
  1220. local Weapon = nil
  1221. local ToolCheck = char:GetChildren()
  1222. for Check = 1, #ToolCheck do
  1223. if ToolCheck[Check].ClassName == "Tool" then
  1224. Weapon = ToolCheck[Check]
  1225. end
  1226. end
  1227. if Weapon ~= nil and Weapon:FindFirstChild("Active") ~= nil and Weapon:FindFirstChild("TargetPos") ~= nil and Weapon:FindFirstChild("Type") ~= nil then
  1228. if Weapon.Type.Value == "Melee" then
  1229. Prep(Target.Position + Vector3.new(math.random(-3, 3), 0, math.random(-3, 3)), Target)
  1230. if (Target.Position - char.Torso.Position).Magnitude <= 10 then
  1231. Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
  1232. Weapon.Active.Value = true
  1233. end
  1234. elseif Weapon.Type.Value == "Melee/Ranged" then
  1235. if Distance <= 10 then
  1236. Prep(Target.Position + Vector3.new(math.random(-3, 3), 0, math.random(-3, 3)), Target)
  1237. Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
  1238. Weapon.Active.Value = true
  1239. else
  1240. Prep(Target.Position + (char.Torso.Position - Target.Position).Unit * 40, Base)
  1241. if (Target.Position - char.Torso.Position).Magnitude <= 50 then
  1242. Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
  1243. Weapon.Active.Value = true
  1244. end
  1245. end
  1246. elseif Weapon.Type.Value == "Melee/RangedMed" then
  1247. if Distance <= 10 then
  1248. Prep(Target.Position + Vector3.new(math.random(-3, 3), 0, math.random(-3, 3)), Target)
  1249. Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
  1250. Weapon.Active.Value = true
  1251. else
  1252. Prep(Target.Position + (char.Torso.Position - Target.Position).Unit * 30, Base)
  1253. if (Target.Position - char.Torso.Position).Magnitude <= 40 then
  1254. Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
  1255. Weapon.Active.Value = true
  1256. end
  1257. end
  1258. elseif Weapon.Type.Value == "Melee/RangedClose" then
  1259. if Distance <= 10 then
  1260. Prep(Target.Position + Vector3.new(math.random(-3, 3), 0, math.random(-3, 3)), Target)
  1261. Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
  1262. Weapon.Active.Value = true
  1263. else
  1264. Prep(Target.Position + (char.Torso.Position - Target.Position).Unit * 20, Base)
  1265. if (Target.Position - char.Torso.Position).Magnitude <= 30 then
  1266. Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
  1267. Weapon.Active.Value = true
  1268. end
  1269. end
  1270. elseif Weapon.Type.Value == "Ranged" then
  1271. Prep(Target.Position + (char.Torso.Position - Target.Position).Unit * 80, Base)
  1272. Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
  1273. wait()
  1274. Weapon.Active.Value = true
  1275. elseif Weapon.Type.Value == "RangedMed" then
  1276. Prep(Target.Position + (char.Torso.Position - Target.Position).Unit * 60, Base)
  1277. if Distance <= 70 then
  1278. Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
  1279. wait()
  1280. Weapon.Active.Value = true
  1281. end
  1282. elseif Weapon.Type.Value == "RangedClose" then
  1283. Prep(Target.Position + (char.Torso.Position - Target.Position).Unit * 30, Base)
  1284. if Distance <= 40 then
  1285. Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
  1286. wait()
  1287. Weapon.Active.Value = true
  1288. end
  1289. elseif Weapon.Type.Value == "RangedAngle" and Distance <= 100 then
  1290. local Position = Target.Position + (char.Torso.Position - Target.Position).Unit * (char.Torso.Position - Target.Position).Magnitude + Target.Velocity
  1291. --char.Humanoid:MoveTo(Position, Base)
  1292. Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
  1293. wait()
  1294. Weapon.Active.Value = true
  1295. elseif Weapon.Type.Value == "RangedTactical" then
  1296. if Distance <= 30 then
  1297. local Position = Target.Position + (char.Torso.Position - Target.Position).Unit * 50
  1298. Prep(Position, Base)
  1299. elseif Distance >= 50 then
  1300. Prep(Target.Position, Target)
  1301. end
  1302. if Distance <= 50 and Distance >= 30 then
  1303. Prep(Target.Position + (char.Torso.Position - Target.Position).Unit * 40, Target.Parent.Torso)
  1304. end
  1305. if Distance <= 60 then
  1306. Weapon.TargetPos.Value = Target.Position + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
  1307. wait()
  1308. Weapon.Active.Value = true
  1309. end
  1310. elseif Weapon.Type.Value == "Shuriken" then
  1311. if Distance <= 15 then
  1312. local Position = Target.Position + (char.Torso.Position - Target.Position).Unit * 20
  1313. Prep(Position, Base)
  1314. elseif Distance >= 30 then
  1315. Prep(Target.Position, Target)
  1316. end
  1317. if Distance <= 30 and Distance >= 15 then
  1318. Prep(Target.Position + (char.Torso.Position - Target.Position).Unit * 20, Target.Parent.Torso)
  1319. end
  1320. if Distance <= 50 then
  1321. Weapon.TargetPos.Value = (Target.Position + Target.Velocity / 2) + Vector3.new(math.random(-2, 2), math.random(-2, 2) + ((Target.Position + Target.Velocity / 2) - char.Torso.Position).Magnitude / 8, math.random(-2, 2))
  1322. wait()
  1323. Weapon.Active.Value = true
  1324. end
  1325. elseif Weapon.Type.Value == "HealDrink" then
  1326. local Position = Target.Position + (char.Torso.Position - Target.Position).Unit * 120
  1327. Prep(Position, Base)
  1328. if char.Humanoid.Health < char.Humanoid.MaxHealth then
  1329. Weapon.Active.Value = true
  1330. end
  1331. elseif Weapon.Type.Value == "GrenadeDirect" then
  1332. if Distance >= 80 and Distance <= 100 then
  1333. Prep(Target.Position, Target)
  1334. wait(0.5)
  1335. Weapon.Active.Value = true
  1336. wait(0.5)
  1337. local Position = Target.Position + (char.Torso.Position - Target.Position).Unit * 100
  1338. Prep(Position, Base)
  1339. else
  1340. local Position = Target.Position + (char.Torso.Position - Target.Position).Unit * 100
  1341. Prep(Position, Base)
  1342. end
  1343. elseif Weapon.Type.Value == "Bomb" then
  1344. if Distance > 10 then
  1345. Prep(Target.Position, Target)
  1346. elseif Distance <= 10 then
  1347. Weapon.Active.Value = true
  1348. wait(2)
  1349. while Weapon ~= nil and Weapon:FindFirstChild("Handle") ~= nil and Weapon.Handle.Transparency == 1 do
  1350. Prep(Target.Position + (char.Torso.Position - Target.Position).Unit * 80, Base)
  1351. wait(0.5)
  1352. end
  1353. end
  1354. elseif Weapon.Type.Value == "Backstab" then
  1355. if Distance >= 10 then
  1356. if (char.Torso.Position - (Target.Position + Target.CFrame.lookVector * 50)).Magnitude <= 52 then
  1357. Prep(Target.Position, Target)
  1358. else
  1359. if (char.Torso.Position - (Target.Position - Target.CFrame.lookVector * 15)).Magnitude <= 5 then
  1360. Prep(Target.Position, Base)
  1361. local backstab_time = 20
  1362. while backstab_time > 1 and (char.Torso.Position - Target.Position).Magnitude >= 4 do
  1363. wait(0.1)
  1364. backstab_time = backstab_time - 1
  1365. end
  1366. if (char.Torso.Position - Target.Position).Magnitude < 4 then
  1367. Weapon.Active.Value = true
  1368. end
  1369. else
  1370. Prep(Target.Position - Target.CFrame.lookVector * 15, Base)
  1371. end
  1372. end
  1373. else
  1374. Prep(Target.Position + Vector3.new(math.random(-2, 2), 0, math.random(-2, 2)), Target)
  1375. if Distance <= 5 then
  1376. Weapon.Active.Value = true
  1377. end
  1378. end
  1379. elseif Weapon.Type.Value == "Crossbow" then
  1380. if Distance > 80 then
  1381. Prep(Target.Position, Target)
  1382. elseif Distance < 40 then
  1383. Prep(Target.Position + (char.Torso.Position - Target.Position).Unit * 100, Base)
  1384. elseif Distance <= 80 and Distance >= 40 then
  1385. Prep(Target.Position + (char.Torso.Position - Target.Position).Unit * ((char.Torso.Position - Target.Position).Magnitude - 5), Base)
  1386. wait(0.2)
  1387. Weapon.TargetPos.Value = Target.Position + Target.Velocity / 8 + Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
  1388. Weapon.Active.Value = true
  1389. end
  1390. end
  1391. IsInCombat = true
  1392. elseif Distance <= 100 then
  1393. local Position = Target.Position + (char.Torso.Position - Target.Position).Unit * 120
  1394. Prep(Position, Base)
  1395. end
  1396. end
  1397. if IsInCombat == true then
  1398. wait(0.2)
  1399. else
  1400. wait(0.6)
  1401. end
  1402. end
  1403. local Weapon = nil
  1404. local ToolCheck = char:GetChildren()
  1405. for Check = 1, #ToolCheck do
  1406. if ToolCheck[Check].ClassName == "Tool" then
  1407. Weapon = ToolCheck[Check]
  1408. end
  1409. end
  1410. if Weapon ~= nil and char.DropWeapon.Value == true then
  1411. Weapon.Parent = Workspace
  1412. elseif Weapon ~= nil then
  1413. Weapon:Remove()
  1414. end
  1415. if char:FindFirstChild("IsAZombie") ~= nil then
  1416. char.Name = "New Zombie"
  1417. char.Humanoid.MaxHealth = char.Humanoid.MaxHealth + math.random(math.random(-50, -25), math.random(25, math.random(50, 100)))
  1418. wait()
  1419. char.Humanoid.Health = char.Humanoid.MaxHealth
  1420. char.Humanoid.WalkSpeed = char.Humanoid.WalkSpeed + math.random(math.random(-200, 0), math.random(100, math.random(200, 300))) / 100
  1421. ZStat = 2
  1422. ZStat2 = 1.57
  1423. Delay(1, function()
  1424. while char:FindFirstChild("Humanoid") ~= nil and char.Humanoid.Health > 0 do
  1425. char.Humanoid.MaxHealth = math.max(0, char.Humanoid.MaxHealth - 1)
  1426. char.Humanoid.Health = math.min(char.Humanoid.Health, char.Humanoid.MaxHealth)
  1427. wait(1)
  1428. end
  1429. end)
  1430. while char.Humanoid.Health > 0 and char:FindFirstChild("IsAZombie") ~= nil do
  1431. local Distance = 100
  1432. local Target = nil
  1433. local Players = Workspace:GetChildren()
  1434. for Check = 1, #Players do
  1435. 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 - char.Torso.Position).Magnitude <= 100 then
  1436. local ZRay = Ray.new(char.Torso.CFrame.p, (Players[Check].Torso.CFrame.p - char.Torso.CFrame.p).Unit * 100)
  1437. local ZHit, ZPos = Workspace:FindPartOnRay(ZRay, char)
  1438. 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
  1439. if ZHit ~= nil and ZHit.Parent ~= nil and ZHit.Parent.Parent ~= nil and (ZHit.Parent == Players[Check] or ZHit.Parent.Parent == Players[Check]) then
  1440. if Players[Check]:FindFirstChild("ZFound") ~= nil then
  1441. Players[Check].ZFound:Remove()
  1442. end
  1443. local ZTag = Instance.new("CFrameValue", Players[Check])
  1444. ZTag.Name = "ZFound"
  1445. game:GetService("Debris"):AddItem(ZTag, 5)
  1446. end
  1447. if (Players[Check].Torso.Position - char.Torso.Position).Magnitude <= Distance then
  1448. Target = Players[Check].Torso
  1449. Distance = (Target.Position - char.Torso.Position).Magnitude
  1450. end
  1451. end
  1452. end
  1453. end
  1454. if Target == nil then
  1455. if char.Humanoid.PlatformStand == false and char.Humanoid.Sit == false then
  1456. if math.random(1, 10) == 1 and char.Wander.Value == true then
  1457. Prep(char.Torso.Position + Vector3.new(math.random(-100, 100), 0, math.random(-100, 100)), Base)
  1458. end
  1459. else
  1460. Jump()
  1461. end
  1462. elseif char.Wander.Value == true then
  1463. --char.Humanoid:MoveTo(Target.Position + Vector3.new(math.random(-2, 2), 0, math.random(-2, 2)), Target)
  1464. end
  1465. wait(0.8)
  1466. end
  1467. end
  1468. end)
  1469. Delay(0, function() --Random Tool Usage Script
  1470. while true do
  1471. wait(math.random(40, 70 + math.random(30, 120)) / 10)
  1472. local Weapon = nil
  1473. local ToolCheck = char:GetChildren()
  1474. for Check = 1, #ToolCheck do
  1475. if ToolCheck[Check].ClassName == "Tool" then
  1476. Weapon = ToolCheck[Check]
  1477. end
  1478. end
  1479. if Weapon ~= nil and Weapon:FindFirstChild("Active") ~= nil and Weapon:FindFirstChild("TargetPos") ~= nil and Weapon:FindFirstChild("Type") ~= nil then
  1480. if Weapon.Type.Value == "HealDrink" then
  1481. Weapon.Active.Value = true
  1482. end
  1483. end
  1484. end
  1485. end)
  1486. Delay(1, function() --Player Customization Script
  1487. BColors = {3, 5, 12, 18, 108, 128, 138, 224, 224, 226, 226}
  1488. SColors = {145, 146, 147, 148, 149, 150, 168, 176, 178, 179, 200}
  1489. PColors = {190, 191, 193, 1024, 1025, 1026, 1027, 1028, 1029, 1030}
  1490. BColor = BrickColor.new(BColors[math.random(1, #BColors)])
  1491. SColor = BrickColor.new(SColors[math.random(1, #SColors)])
  1492. PColor = BrickColor.new(PColors[math.random(1, #PColors)])
  1493. if char.IsOnTeam.Value == true then
  1494. SColor = char.IsOnTeam.Team.Value
  1495. PColor = SColor
  1496. if char.IsOnTeam.ShowTag.Value == true then
  1497. char.Name = char.Name .." [" ..char.IsOnTeam.Team.Value.Name .."]"
  1498. end
  1499. end
  1500. char.Head.BrickColor = char["Body Colors"].HeadColor
  1501. char["Left Arm"].BrickColor = char["Body Colors"].LeftArmColor
  1502. char["Left Leg"].BrickColor = char["Body Colors"].LeftLegColor
  1503. char["Right Arm"].BrickColor = char["Body Colors"].RightArmColor
  1504. char["Right Leg"].BrickColor = char["Body Colors"].RightLegColor
  1505. char.Torso.BrickColor = char["Body Colors"].TorsoColor
  1506. if char["Force_Weapon"].Value ~= 0 then
  1507. local x = game:GetService("InsertService"):LoadAsset(char["Force_Weapon"].Value)
  1508. local c = x:GetChildren()
  1509. for i = 1, #c do
  1510. 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
  1511. c[i].Parent = char
  1512. char.DropWeapon.Value = false
  1513. end
  1514. end
  1515. end
  1516. if char["Force_Hat"].Value ~= 0 then
  1517. local x = game:GetService("InsertService"):LoadAsset(char["Force_Hat"].Value)
  1518. local c = x:GetChildren()
  1519. for i = 1, #c do
  1520. if c[i].ClassName == "Hat" and c[i]:FindFirstChild("Handle") ~= nil then
  1521. c[i].Parent = char
  1522. end
  1523. end
  1524. end
  1525. if char["Force_Shirt"].Value ~= 0 then
  1526. local x = game:GetService("InsertService"):LoadAsset(char["Force_Shirt"].Value)
  1527. local c = x:GetChildren()
  1528. for i = 1, #c do
  1529. if c[i].ClassName == "Shirt" then
  1530. c[i].Parent = char
  1531. end
  1532. end
  1533. end
  1534. if char["Force_Pants"].Value ~= 0 then
  1535. local x = game:GetService("InsertService"):LoadAsset(char["Force_Pants"].Value)
  1536. local c = x:GetChildren()
  1537. for i = 1, #c do
  1538. if c[i].ClassName == "Pants" then
  1539. c[i].Parent = char
  1540. end
  1541. end
  1542. end
  1543. end)
  1544. wait()
  1545. coroutine.resume(coroutine.create(function()
  1546. while true do
  1547. for i,v in pairs(char.Animate:GetChildren()) do
  1548. for i,animation in pairs(v:GetChildren()) do
  1549. animation.AnimationId = "rbxassetid://0"
  1550. dooo = char.Humanoid:LoadAnimation(animation)
  1551. dooo:Stop()
  1552. end
  1553. end
  1554. wait(0.0001)
  1555. end
  1556. end))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement