Hey Developers!
Recently I am working on a pet system, and I have a question regarding this. How do games like Adopt Me or Pet Simulator where your pet follows you - when the character jumps, the pet does not. How can I achieve it? I also add videos of what I mean. (Sorry for the quality, I recorded through Roblox)
They could be raycasting from the position where the pet is supposed to be downwards to see where the ground is and then using the raycast’s hit position to change the pet’s Y position while keeping and X and Z positions relative to the player
I think that you can achieve this by using humanoid states in your loops
local hum = player.Character.Humanoid
while wait() do
local humState = hum:GetState()
if humState == Enum.HumanoidStateType.Jumping or humState == Enum.HumanoidStateType.Falling then
--make the pet to don't move in Y axis like Vector3.new(1,0,1)
else
--make the pet to move normally like Vector3.new(1,1,1)
end
end