okay I added alpha as 0.30 as u can see in the prevous code, but now the game said to me this: " Unable to cast Vector3 to CoordinateFrame"
The error is literal you’re trying to set the pet cframe with vector, it wouldn’t work you need to convert it to CFrame instead.
To avoid lag, this is something you should be performing on the client. This avoids desync issues, as well as allows you to use RunService.RenderStepped
as well (which is run before the frame)
RunService.RenderStepped:Connect(function()
pet:PivotTo(ownerHumanoidRootPart:GetPivot())
end)
You can set a CFrame by using a Vector3: CFrame.new(Vector3.new())
yes I solved the lag, but with Pivot, the pet is attached to me and I would like to make it walk and follow me on the basament (something like Livetopia or Adopt me )
You can just multiply an offset CFrame to the Character’s CFrame.
pet:PivotTo(ownerHumanoidRootPart:GetPivot() * CFrame.new(3, -ownerHumanoid.HipHeight, 3))
For example, this will position the behind and to the right of the torso, and on the ground (as long as the player is also on the ground).
If you want to add further polish, you can looking into Raycasting to position the pet exactly on the ground and Mover Constraints to dampen movements (specifically AlignPosition and AlignOrientation).
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.