01 | game.Players.PlayerAdded:connect( function (Player) |
02 | local p = game.Workspace:WaitForChild(Player.Name) |
03 | print (p) |
04 | local f = p.UpperTorso.Position |
05 | print (f) |
06 | local dist = 15 |
07 | local pos 1 = f |
08 | for i,v in pairs (game.Workspace.CrystalMobA.UndeadWarrior:GetChildren()) do |
09 | if v.Name = = "HumanoidRootPart" then |
10 | print (v) |
11 | local z = v.Parent.Humanoid |
12 | local pos 2 = v.Position |
13 | local magnitude = (pos 1 - pos 2 ).magnitude |
14 | if magnitude < = 15 and z then |
15 | if p.Humanoid ~ = nil then |