Henlo frens. I am currently facing the issue as to my NPC being a very bad boi and stuttering when i change his CFrame. For reference, here is how he performs when i dont change CFrame to face character direction:
Now, here he is misbehaving and stuttering when all he has to do is face the character.
And here is the manuscript he has to read out for the play:
local collectionService = game:GetService("CollectionService")
local players = game:GetService("Players")
local runService = game:GetService("RunService")
local pathfindingService = game:GetService("PathfindingService")
local simplePath = require(game.ReplicatedStorage.SimplePath)
local funnyMen = collectionService:GetTagged("GunnerImp")
local maxDistance = 100
local waypoints
local nextWaypointIndex
local reachedConnection
local blockedConnection
local path
local filterinoes = {}
for i, v in pairs(funnyMen) do
table.insert(filterinoes, v)
end
for i, v in pairs(players:GetChildren()) do
table.insert(filterinoes, v.CharacterAdded:Wait())
end
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Blacklist
params.FilterDescendantsInstances = filterinoes
function idle(v)
local humanoid = v:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
task.spawn(function()
local distance = nil
local closestPlayer = nil
local pathing = false
while true do
closestPlayer = simplePath.GetNearestCharacter(v.PrimaryPart.Position)
wait()
if closestPlayer ~= nil then
path = pathfindingService:CreatePath()
path:Run((closestPlayer.PrimaryPart.Position - CFrame.new(v.HumanoidRootPart.Position, closestPlayer.PrimaryPart.Position).LookVector * 30))
end
end
end)
end
for i,v in pairs(funnyMen) do
idle(v)
end
I am currently crying and chugging down a bottle of wine. I am a single mother and i dont know what to do with this child, do i need to send him to a psychologist and get evaluated for general anxiety disorder? is this just a phase? will i ever be a good mother? please help.