Model follow player

i want a model to follow neares player,
i tried using linear velocity but it wasnt good for whole models,

this is billy, he generates legs after i run the game, and if model moves far, legs will follow it using bezier curves,

so only thing i need is to make this model follow players using cframe,
after this im gonna script some attacking tentacles so he can kill players but first he has to come close to players,
im trying to make him use crframes and im calling him a model, because he is not rigged and it doesnt has humanoid, i can add humanoid but it wont have legs, torso, head, arms, or i wont be able to rig and animate him, so i need a basic model cframe follow script that detects neares player, i would appreciate all help and i can pay for the script!

my discord: couch_0

1 Like

Since it’s not using a humanoid, I’m guessing the best approach would probably be to use TweenService for moving to the player, however I’m not sure how walk animations would work but I’ll leave that up to you.

As for finding the nearest player, you can use RayCasting if you want the model to have a limited vision radius, and Magnitude to calculate the distance of each player from the model.

legs will work with tween i think, but i never used raycasting, can you write an example script maybe? pls

There’s a lot of good videos on youtube explaining how it works, I would recommend looking around. This one is the one I used to learn

thanks, i now know raycasting, but i still dont know how to make models work like zombies

i suggest you create a NPC model with a humanoid and Motor6D to make them work like zombies.

i cant rig billy, i tried welding it to an npc but didnt work

why can’t you rig it? if you want to weld it then it won’t be able to play animations properly

youre gonna want to connect it to an invisible humanoidrootpart and get proper motor6ds on them, itll make your life so much easier doing all of the work in a humanoid rather entirely thru script

i wont add animations, this is the main problem, its not a rig i cant use pathfinding and moveto() so i need a way to make model to follow player but only in X and Z not in Y position

i basically, cant, i tried. i cant rig it, i tried welding it to another rig, now rig cant move

you can use weld constraint to make them all welded then put this script:

local model = --put your model here
local Y = --put your Y position you want here since you don't wanna change it
local player = --put your player here
while task.wait() do
    -- pcall because player character might not load on time and im too lazy to put all those conditions

thanks this scripts looks helpfull, but will Moveto() work without a rig?

ok i made it find the neares player, and then use your script, but it just teleports on the players head, and it changes Y pos even if i set it 111 or 0

	local Y = 0

local function FindNearestPlayer(position)
	local found
	local last = math.huge
	for _,plyr in pairs(game.Players:GetPlayers()) do
		local distance = plyr:DistanceFromCharacter(position)
		if distance < last then
			found = plyr
			last = distance
	return found

	while task.wait(2) do

	local player = FindNearestPlayer(script.Parent.HumanoidRootPart.Position)


local model = script.parent

it didnt get it onto the message for some reason

yes MoveTo() works for any model, if it doesn’t have a rig, it will teleport to that position/

You didn’t copy my code correctly. I said


Also the interval should be task.wait(), not task.wait(2)

you just changed the wait time and added distance to axises?

exactly, the time is for making the model not seem like it’s “teleporting”

and the added constant to the x and z axis is for it to not be on the player’s head

why don’t you just try the code I sent?

it doesnt has humanoid so it cant walk it just teleports, i used ur code properly