Making a HUMANOID MODEL face a PLAYER?

Hello! I’m making sort of an enemy attack where it picks a random player and attacks the player, but for some reason nothing works when i try to rotate the model to the player.

I have been looking for hours and i found nothing so i am making this.

Can anyone help on rotating a humanoid model to face a player?

4 Likes

Just do something like this with CFrame:lookAt:

local hum_model = replace.with.path
local randomplr = path.to.random.plr

hum_model.PrimaryPart.CFrame = CFrame:lookAt(hum_model.PrimaryPart.Position, randomplr.Character.PrimaryPart.Position)

idk whats happening but everytime i use cframe.lookat the humanoid just doesnt appear [btw its a tentacle that uses an animation to go out of the ground and smacks the player]

	local function TentacleSmackAttack(PlayerSelected)
		print("Smack Started")
		local Tentacle = game.ReplicatedStorage.BossFightAttacks.TentacleSlam:Clone()
		game:GetService('RunService').Stepped:Wait()
		CanAttack = false
		Tentacle.Parent = workspace
		Tentacle.PrimaryPart.CFrame = CFrame.lookAt(Tentacle.PrimaryPart.Position, PlayerSelected.Character.PrimaryPart.Position)
		wait(0.5)
		local Anim = Tentacle.Humanoid.Animator:LoadAnimation(script.SlamAnim)
		wait(0.5)
		Anim:Play()
		Anim.Ended:Wait()
		print("Attack Finished")
		wait(1)
		CanAttack = true
		Tentacle:Destroy()
	end

this is where i used it. idk whats happening.

there are no errors and it works when i dont have the tentacle look at something

1 Like

ohh i get it. it doesnt work cuz it tilts the model. so it is on its side and not facing up

this is what happens when it “tries” to face the player

and this is what is supposed to happen [ignore the green thing]

so the model is on its side when its supposed to face up.

also here is the face of everything in the model. im showing the humanoidrootparts face in this image.


[i use decals cuz idk where the old thing went to check the face of a part]

welp i’m stumped. idk what to do.

you can just use CFrame.Angles() to add an offset orientation to a model

just fiddle with

* CFrame.Angles(math.rad(90), 0, 0) 

putting new values inside of a math.rad() if it isn’t 0

then just add it to the end of:

Tentacle.PrimaryPart.CFrame = CFrame.lookAt(Tentacle.PrimaryPart.Position, PlayerSelected.Character.PrimaryPart.Position) --[[ "* CFrame.Angles()" goes here ]]--

let me know if it works or not!

btw you can just use Tentacle:PivotTo(lookAtCFrame) instead of Tentacle.PrimaryPart.CFrame = lookAtCFrame

1 Like

your such a lifesaver! I have been stuck on this for hours!

1 Like

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