How can I achieve Pet jump lock?

Hey Developers! :wave:
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)

My Game:
robloxapp-20210119-0805155.wmv

Adopt Me:
robloxapp-20210119-0814101.wmv

Thanks in advance for any answers! :smiley:

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

1 Like

You can use Body Position to make that.

Or here is a tutorial on youtube:

2 Likes

OP already has pets set up, they want to know how to make the pet stay at the ground instead of levitating up when the player jumps.

1 Like

Exactly as @heII_ish said, it’s not what I expected, but thanks :slight_smile:

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
2 Likes

Thank you, I’ll try it :slight_smile:

1 Like