#guys i need help why my npcs is killing each other but not the player first
1 messages · Page 1 of 1 (latest)
It’s attacking anything with a humanoid, it will attack whatever exists.
how to fix it so it will kill only player
Show us the script.
uhh there is multiply script because i got them from enemy npc with sword.. do i need to show all the scripts?
yo there is multiple script which one i need to send
nvm i give up, please dont use free models dude
sorry. my scripting skills are just bad and i cant script.. i just want to create the game that i can play with my friends
** You are now Level 1! **
i am not fatass stop
THATS NOT TRUE THATS FAKEE
yo fish i think i have script that is easier to fix but i got this problem anyways
function findNearestTorso(pos)
local list = game.Workspace:GetChildren()
local torso = nil
local dist = 10000
local temp = nil
local human = nil
local temp2 = nil
for x = 1, #list do
temp2 = list[x]
if (temp2.className == "Model") and (temp2 ~= script.Parent) then
temp = temp2:findFirstChild("HumanoidRootPart")
human = temp2:findFirstChild("Humanoid")
if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
if (temp.Position - pos).magnitude < dist then
torso = temp
dist = (temp.Position - pos).magnitude
end
end
end
end
return torso
end
while true do
wait(0.001)
local target = findNearestTorso(script.Parent.HumanoidRootPart.Position)
if target ~= nil then
script.Parent.Humanoid:MoveTo(target.Position, target)
end
end
this is follow script
while true do script.Parent.ClassicSword:Activate() task.wait(2) end
this is swordActivate script