В Roblox Studio чтобы NPC бегал и убивал игрока? Я хочу сделать карту в которой за игроком будет бегать монстр и убивать его, но получается что он просто ходит куда хочет и бьёт только других NPC.?
Этот ответ написан и доступен на
Этот ответ написан и доступен на Яндекс Кьюнужна моделька и нужно создать скрипт в который вписать данный ниже текст (если что можно сделать всё в одном скрипте )
скрипт на приследование
local larm = script.Parent:FindFirstChild("Left Arm")
local rarm = script.Parent:FindFirstChild("Right Arm")
function findNearestTorso(pos)
local list = game.Workspace:children()
local torso = nil
local dist = 10000000000 --This Line Right Here
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("Head")
human = temp2:findFirstChild("Humanoid")
Friend = temp2:findFirstChild("Friend")
if (temp ~= nil) and (human ~= nil) and (Friend == nil) or (temp ~= nil) and (human ~= nil) and (human.Health > 0) and (Friend.Value ~= script.Parent.Friend.Value) 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.1)
local target = findNearestTorso(script.Parent.Torso.Position)
if target ~= nil then
script.Parent.Humanoid:MoveTo(target.Position, target)
end
end
на убийство
local larm = script.Parent:FindFirstChild("Left Arm")
local rarm = script.Parent:FindFirstChild("Right Arm")
function findNearestTorso(pos)
local list = game.Workspace:children()
local torso = nil
local dist = 300 -- Change this value to distance of detecting you.
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("Torso")
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
function Hit(hit)
local human = hit.Parent:FindFirstChild("Humanoid")
if human ~= nil then
human.Health = human.Health -10 -- Change this value to dmg of monster.
end
end
larm.Touched:connect(Hit)
rarm.Touched:connect(Hit)
while true do
wait(0.1)
local target = findNearestTorso(script.Parent.Torso.Position)
if target ~= nil then
script.Parent.Zombie:MoveTo(target.Position, target)
end
end
Этот ответ написан и доступен на
Этот ответ написан и доступен на Яндекс КьюПосуте надо написать NPC в пойск предметоа и дать NPC характиристику чтобы он ходил на такой скорости и бил других на такой урон напрример: скорость 30 а урон 70
эм а какой скрипт надо писать ответ бесполезен для тех кто не знает языка программирования
Слушай а как сделать чтобы он не только бегал за мной и убивал а еще к тому же на некотором расстоянии от него не гнался за мной (я попробовал типо убежать до конца карты и он все равно за мной бежит)
@aid d45, local dist = 10000000000 --This Line Right Here
ищешь такую строчку и цифры это растояние его виденья
local dist = 10000000000 --This Line Right Here
ищешь такую строчку и цифры это растояние его виденья