#Other parts don't follow the head
1 messages · Page 1 of 1 (latest)
im trying to make he move to the player with the horns and eyes
and he looks at the player too
so u want his horns and eyes to follow the plrs look at dierection?
no
wdym
look at the script
the head follows the player but the horns and eyes aren't with the head
i draw it
i did this
which weld did u use?
weld constraint
yes
no
so u want the
accessory's to not move but the skull does
or do u want it follow it
follow
if so i made a script for it
rlly?
local Players = game:GetService("Players")
local FakeHead = script.Parent.PrimaryPart
local function WeldAccessoriesToFakeHead(character, fakeHead)
for _, accessory in pairs(character:GetChildren()) do
if accessory:IsA("Accessory") then
local handle = accessory:FindFirstChild("Handle")
if handle then
local oldWeld = handle:FindFirstChildWhichIsA("Weld")
if oldWeld then
oldWeld:Destroy()
end
local weld = Instance.new("WeldConstraint")
weld.Part0 = handle
weld.Part1 = fakeHead
weld.Parent = handle
handle.CFrame = fakeHead.CFrame
end
end
end
end
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
WeldAccessoriesToFakeHead(character, FakeHead)
game:GetService("RunService").Heartbeat:Connect(function()
local rootPart = character:WaitForChild("HumanoidRootPart")
local playerPos = rootPart.Position
FakeHead.CFrame = CFrame.new(FakeHead.Position, playerPos)
FakeHead.Position += FakeHead.CFrame.LookVector * 0.5
end)
end)
end)
there
see if it works
oh thanks
did it work?
u can remove the old welds part if u want
it will just auto set it up for you
or u can follow the weld process
hmm
but is just i code the welds then?
wait
i will try fix some stuff and i see if works
k
if so
one more question
do u want it to follow the plrs head
like where evr they look?
?
k
i made something similar to that
expect in the
stater player
so it can avoid
looking at multiple plrs at once
and only look at one based on there POV
so what i did
if ur working wiht a rig
like an r6 rig
u can make the a motor 6d look at the player
the game is just for one person
k
if so
then u can use it inside the model
or something
so try using a motor 6d
the acess can be weld
u can use
plr.PlayerAdded:Connect(function(Player)
game["RunService"].Heartbeat:Connect(function()
end)
end)```
yeah
i used this func local torso = npc:WaitForChild("Torso", 3)
local neck = torso and torso:WaitForChild("Neck", 3)
if torso and neck then
npcs[npc] = {
Torso = torso,
Neck = neck,
LastTransform = CFrame.new()
}
if so it will remove it
if its out of range
instead of using heart beat
i used Stepped
k
this is the main code for me local torsoCFrame = data.Torso.CFrame
local distance = (rootPart.Position - torsoCFrame.Position).Magnitude
if distance <= 75 then
local isCloseEnoughToStare = distance < 25 and torsoCFrame.LookVector:Dot((rootPart.Position - torsoCFrame.Position).Unit) > 0.25
local targetPos = isCloseEnoughToStare and rootPart.Position or torsoCFrame.Position + torsoCFrame.LookVector
local localLookVector = CFrame.new(targetPos, torsoCFrame.Position):ToObjectSpace(torsoCFrame).LookVector * Vector3.new(1, -1, 1)
local xAngle = -math.asin(localLookVector.y)
local zAngle = -math.asin(localLookVector.x)
local targetTransform = CFrame.Angles(0, 0, zAngle) * CFrame.Angles(xAngle, 0, 0)
data.LastTransform = data.LastTransform:Lerp(targetTransform, 0.1)
data.Neck.Transform = data.LastTransform
try using tags
in collective service
mainly to ur model
like this
hope this helps
ok i will put
k
** You are now Level 10! **
got some errors