Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can i make it so a monsters head looks at you as walking?

I literally have no idea how to do this, help is extremely appreciated. :D

2 answers

Insert this into game.StarterPlayer.StarterCharacterScripts:

if workspace.Monster.Head:FindFirstChild("Neck") == nil then
workspace.Monster.Neck:Destroy()
end

local newConstraint = Instance.new("WeldConstraint", workspace.Monster.Head)
newConstraint.Part0 = workspace.Monster.Head
newConstraint.Part1 = workspace.Monster.HumanoidRootPart

while true do
    workspace.Monster.Head.Orientation =  Vector3.new(0,script.Parent.Head.Orientation.Y - 45,0)
	wait(0.01)
end

2 comments

0

i don't understand

0

sorry :(

Use CFrame.new, but the first argument is the position it's at and the second argument is the position it's looking at.

Sample:

local MR = math.random;

local a = Instance.new("Part",workspace);
a.BrickColor = BrickColor.new("Really red");
a.Position = Vector3.new(MR(1,10)-5,MR(1,10),MR(1,10)-5);
a.Anchored = true;

local b = Instance.new("Part",workspace);
b.Position = Vector3.new(MR(1,10)-5,MR(1,10),MR(1,10)-5); -- These positions are randomized
b.Anchored = true;


a.CFrame = CFrame.new(a.Position,b.Position)
 -- this is the part where variable "a", the red part, looks at variable "b" the grey part

This discussion is preserved as it was. New answers, comments, and votes are closed.