I'm trying to make a NPC float behind a player with filtering enabled. With filtering disabled this runs smoothly, but with it enabled it has a pretty big delay.
I placed this script inside the HumanoidRootPart:
--Variables
local character = script.Parent.Parent.Parent
local humanoid = char:FindFirstChild("Humanoid")
local humanoidrootpart = character:FindFirstChild("HumanoidRootPart")
local followpart = script.Parent
local RunService = game:GetService('RunService')
--Teleport the NPC behind the player
followpart.CFrame = humanoidrootpart.CFrame * CFrame.new(2,4,3)
--Move NPC
RunService.Stepped:connect(function(step)
if followpart ~= nil and humanoid~= nil and humanoidrootpart ~= nil then
local cf = humanoidrootpart.CFrame * CFrame.new(2,4,3)
followpart.BodyPosition.Position = Vector3.new(cf.x,cf.y,cf.z)
followpart.BodyGyro.CFrame = humanoidrootpart.CFrame * CFrame.new(0,0,0)
end
end)
All of the parts are set to Anchored = false and CanCollide = false

4 comments
You aren't crossing client and server? Filtering Enabled wouldn't have any affect on this.
This is probably inefficient but you can try making 2 of these bricks a local version of this so there isn't a delay, and a second one that's serverside, while making the serverside version of the brick transparent to the client itself.
This is in a normal script inside the birck,
@V_ChampionSSR You missed me