So I've been looking at this pet (follow) system and I can't figure out what's wrong with it, the pet was always looking at one direction then I've fixed that so it moves with the characters direction but it still looks the wrong way, I want it facing the character's direction.
Thank you in advanced.
The script that makes the magic happen.
game.ReplicatedStorage.Events.GivePet.OnClientEvent:Connect(function(Pet)
local Character = Player.Character
Pet:SetPrimaryPartCFrame(Character.PrimaryPart.CFrame)
local BodyGyro = Instance.new("BodyGyro")
BodyGyro.Parent = Pet.PrimaryPart
BodyGyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
local BodyPosition = Instance.new("BodyPosition")
BodyPosition.Parent = Pet.PrimaryPart
end)
game:GetService("RunService").RenderStepped:Connect(function()
local Pet = workspace.Pets:FindFirstChild(Player.Name)
if not Pet then return end;
local BodyPosition = Pet.PrimaryPart.BodyPosition
local BodyGyro = Pet.PrimaryPart.BodyGyro
game:GetService("RunService").Heartbeat:Connect(function()
--BodyPosition.Position = Character.HumanoidRootPart.Position + Vector3.new(2, 2, 3)
--BodyGyro.CFrame = Character.HumanoidRootPart.CFrame + Vector3.new(0,10,10)
BodyPosition.Position = Character.HumanoidRootPart.Position + Vector3.new(3, 3, 4)
BodyGyro.CFrame = Character.HumanoidRootPart.CFrame
end)
end)
It's a model, with parts / unions in it.

1 comment
Have you tried it? How did it go?