Making a model look at the player

Im trying to make a monster that follows the player, i already got it moving but i dont know how to rotate i already have tried using CFrame.LookAt but doesnt work is there any other method to do it?..

--LOCAL SCRIPT
local plr = game:GetService("Players").LocalPlayer
local LookingPart = workspace.bigtallguy.Torso
local rs = game:GetService("RunService")
while wait() do
	if plr.Character ~= nil then
		wait(0.1)
		--local LookAtCF = CFrame.lookAt(LookingPart.Position, plr.Character.PrimaryPart.Position)
		script.RemoteEvent:FireServer(Vector3.new(plr.Character.PrimaryPart.Position))
	end
end
--SERVER SCRIPT
script.Parent.OnServerEvent:Connect(function(plr,Vector)
	print("recieved and done")
	workspace.bigtallguy.Torso.Attachment.LinearVelocity.VectorVelocity = Vector3.new(-200,0,0)
	workspace.bigtallguy.Head.CFrame = CFrame.lookAt(workspace.bigtallguy.Head.Position,Vector)
end)

6 Likes

you can try something like this.

local model = --goofy model goes here
--make sure the model or character has a primary part
local lookVector = (plr.Character.HumanoidRootPart.Position - model:GetModelCFrame().Position).Unit
model:SetPrimaryPartCFrame(CFrame.lookAt(model:GetModelCFrame().Position, model:GetModelCFrame().Position + lookVector))
4 Likes

Gives the same result as CFrame.LookAt maybe its the way i welded it because it does rotate

1 Like

how exactly do the results look like?
i think ik bc its rotating on the y axis lemme fix that rq

1 Like


it like tilting to the player, its kind of funny

3 Likes
local lookVector = (plr.Character.HumanoidRootPart.Position - Vector3.new(model:GetModelCFrame().Position.X,0,model:GetModelCFrame().Position.Z)).Unit|
model:SetPrimaryPartCFrame(CFrame.lookAt(model:GetModelCFrame().Position, Vector3.new(model:GetModelCFrame().Position.X,0,model:GetModelCFrame().Position.Z) + lookVector, Vector3.new(0, 1, 0)))|

Try this

2 Likes

I managed to fix it by adding a root part and welding it to all of the parts and now it rotates perfectly thank u!

2 Likes

glad to hear that, good luck on your game dude!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.