Hey there,
I am trying to rework the way my pets move, and I am having some trouble moving them smoothly.
I am using attachments now instead of previously using tweens.
The issue:
Explorer:
Code:
local Object = script.Parent
local NAME = Object.NameValue
local pet = Object.PrimaryPart.Position
wait(3)
local character = NAME.Value
local player = game.Players:GetPlayerFromCharacter(character)
if NAME.Value ~= nil then
script.Parent.Head.AlignOrientation.Attachment1 = character:WaitForChild("Head").NeckRigAttachment
script.Parent.Head.Anchored = false
script.Parent.Head.AlignPosition.Attachment1 = character:WaitForChild("Head").PetAttachment
else
Object:Destroy()
end
function newCharacter(character)
Object:Destroy()
end
player.CharacterAdded:Connect(newCharacter)
function onPlayerLeaving(player)
if player.Name == character.Name then
Object:Destroy()
end
end
game.Players.PlayerRemoving:Connect(onPlayerLeaving)
--script.Parent.Head.Anchored = false
local player = player.Character.Head ---- player here
local pet = Object.PrimaryPart ---- pet position
ds = 3 --- how far player
while true do wait(0.5)
local far = (pet.Position - character.Head.Position).Magnitude
if far >= ds then
pet.CFrame = player.CFrame
end
end
What is really strange is that I have rigidity enabled for the alignPosition
I have no clue why it is doing this, any help will be appreciated!