|
| 16 Apr 2016 10:01 AM |
this script is killing every thing with enemy in it how do i make it so that it only kills the detected humanoid? (enemy is humanoid)
local Player = script.Parent.Parent local player = game.Players.LocalPlayer local Mouse = player:GetMouse()
function FindNearestHumanoidLocation(point) wait(0.7456) local points = {} for _, a in pairs(game.Workspace:GetChildren()) do if a:IsA("Model") and a:FindFirstChild("Enemy") then table.insert(points,a:GetModelCFrame().p) a.Enemy:TakeDamage(100) end end
local min = 0 local index = 0 for i=1, #points do if i==1 then min = (points[1] - point).magnitude index = 1 else local dist = (point - points[i]).magnitude if dist < min then min = dist index = i end end end return points[index] end
Mouse.KeyDown:connect(function(Key) Key = Key:lower() if Key == "g" then player.Character:MoveTo(FindNearestHumanoidLocation(player.Character.Torso.Position) + Vector3.new(0,0,2.5)) end end) |
|
|
| Report Abuse |
|
Salinas23
|
  |
| Joined: 28 Dec 2008 |
| Total Posts: 37141 |
|
|
| 16 Apr 2016 10:31 AM |
I dont understand the problem.
Is it killing more than it should? Less than it should?
-Salinas con el número 23 |
|
|
| Report Abuse |
|
|
| 16 Apr 2016 01:32 PM |
more than it should
sorry for the late reply |
|
|
| Report Abuse |
|