Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make player1 look at player2?

Asked by 2 years ago
Edited 2 years ago

Look, i am creating a very funny interaction script, and for it to be perfect i need to upon interaction rotate player1's character and make him look at player2. It works perfectly with npc's but not with real players. Here is line of code

local char = player.Character

local position = target.HumanoidRootPart.CFrame:ToWorldSpace(CFrame.new(Vector3.new(0, 0, -5.7)))

local rotation = CFrame.Angles(math.rad(target.HumanoidRootPart.Orientation.X), math.rad(target.HumanoidRootPart.Orientation.Y), math.rad(target.HumanoidRootPart.Orientation.Z)) for i,v in pairs(target.Humanoid:GetPlayingAnimationTracks()) do v:Stop() end

Position works with both player and npc Heres another code line that i put after few other lines char:SetPrimaryPartCFrame(position * rotation) /\ || this is put in order to make player1's humanoidrootpart rotate at specific angle

How do i make it work with players?

Answer this question