Top.Mail.Ru
Ответы
Аватар пользователя

multifora0

Multifora0
подписчиков

Значения кармы
мнения
знания
истории
Аватар пользователя
7 месяцев назад
от
Изменено
Roblox Studio. Помогите исправить скрипт от ИИ.

НЕ ИСПОЛЬЗУЙТЕ ИИ, ОН БУДЕТ ГОВОРИТЬ ЧТО СКРИПТ ПРАВИЛЬНЫЙ!
Сам скрипт такой:
local PathfindingService = game:GetService("PathfindingService")
local prompt = workspace.Atm500.PromptHolder.ProximityPrompt
local npc = script.Parent
local humanoid = npc:FindFirstChildOfClass("Humanoid")
local player = nil

prompt.Triggered:Connect(function(plr)
player = plr
while humanoid and
humanoid.Health > 0 do
if player and player.Character then
local path = PathfindingService:CreatePath({
AgentRadius = 2,
AgentHeight = 5,
AgentCanJump = true,
AgentJumpHeight = 10,
AgentMaxSlope = 45,
})

-- Вычисляем путь к игроку
path:ComputeAsync(npc.HumanoidRootPart.Position, player.Character.HumanoidRootPart.Position)
path:MoveToFinished:Wait() -- Ждем завершения движения по пути
end
wait(1)
end
end)

npc.HumanoidRootPart.Touched:Connect(function(hit)
local playerHumanoid = hit.Parent:FindFirstChildOfClass("Humanoid")
if playerHumanoid then
playerHumanoid.Health = 0
end
end)
Output выдает такую ошибку: