#Path finding script with emotions gone wrong

1 messages · Page 1 of 1 (latest)

compact yacht
#

ill send the script in the chat below since its too big

#

local PathfindingService = game:GetService("PathfindingService")

local npc = script.Parent
local humanoid = npc:FindFirstChildOfClass("Humanoid")
local hrp = npc:FindFirstChild("HumanoidRootPart")
local fearedFolder = npc:FindFirstChild("Feared")

if not humanoid or not hrp then
warn("NPC missing Humanoid or HumanoidRootPart")
return
end

local animator = humanoid:FindFirstChildOfClass("Animator")
if not animator then
animator = Instance.new("Animator")
animator.Parent = humanoid
end

local walkAnim = Instance.new("Animation")
walkAnim.AnimationId = "rbxassetid://180426354"
local walkTrack = animator:LoadAnimation(walkAnim)

local jumpAnim = Instance.new("Animation")
jumpAnim.AnimationId = "rbxassetid://125750702"
local jumpTrack = animator:LoadAnimation(jumpAnim)

humanoid.Running:Connect(function(speed)
if speed > 0.1 then
if not walkTrack.IsPlaying then
walkTrack:Play()
end
else
if walkTrack.IsPlaying then
walkTrack:Stop()
end
end
end)

humanoid.Jumping:Connect(function(active)
if active then
jumpTrack:Play()
else
jumpTrack:Stop()
end
end)

local wanderRadius = 20

local function getRandomOffset(radius)
local x = (math.random() - 0.5) * 2 * radius
local z = (math.random() - 0.5) * 2 * radius
return Vector3.new(x, 0, z)
end

local function isWaypointClear(position)
for _, otherNpc in ipairs(workspace:GetChildren()) do
if otherNpc ~= npc and otherNpc:IsA("Model") then
local otherHrp = otherNpc:FindFirstChild("HumanoidRootPart")
if otherHrp then
if (otherHrp.Position - position).Magnitude < 3 then
return false
end
end
end
end
return true
end

#

omg bra

#

doesnt let me send the other part

oak mural
#

send as .txt

compact yacht
#

ok

compact yacht
oak mural
#

copy ur code into notepad

#

save it

#

drag it onto discord

compact yacht
#

okay

#

@oak mural

#

didnt let me take off rtf

#

sadly

oak mural
#

idk tho

compact yacht
oak mural
compact yacht
#

doesnt work

oak mural
compact yacht
#

wich

#

does an fear emotion kind of

#

but

#

it doesnt detect the player

#

nor run once the player is near the npc

oak mural
compact yacht
oak mural
#

is ur fearfolder set correctly?

#

test this

local fearedNames = {"Ur name goes here"}
compact yacht
#

oh shoot

oak mural
#

did u forgeet to make it?

compact yacht
#

i forgot to put the part

#

where

#

fearednames

#

should be

#

the values of the string values inside the folder

#

yeah ima edit that real quick

#

but ima test

#

the