sIendytubble

become a guest

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