Hey! I am doing a test and was wondering how to modify my code to make it so that my pets aren’t just still objects but more active and cute with run animations.
For obvious reasons i wont be posting ALL the code, but if you need/require more to help me ill share it.
(CONTEXT FOR THOSE WHO HAVE NEVER HEARD OF PS99 OR JUST DON’T UNDERSTAND)
What I want to achieve:
I want the pets to make an UP and DOWN animation like pet simulator 99.
Enough talking here is the main part of the code:
RayParams.FilterDescendantsInstances = {PetFolder, Character}
local MaxRowCapacity = math.ceil(math.sqrt(#Pets))
RearrangeTables(Pets, Rows, MaxRowCapacity)
for i, Pet in Pets do
local RowIndex = math.ceil(i / MaxRowCapacity)
local Row = Rows[RowIndex]
local RowWidth = GetRowWidth(Row, Pet)
local XOffset = #Row == 1 and 0 or RowWidth/2 - Pet.PrimaryPart.Size.X/2
local X = (table.find(Row, Pet) - 1) * Spacing
local Z = RowIndex * Spacing
local Y = 0
local RayResult = workspace:Blockcast(Pet.PrimaryPart.CFrame + Vector3.new(0, MaxClimbHeight, 0), Pet.PrimaryPart.Size, RayDirection, RayParams)
if RayResult then
Y = RayResult.Position.Y + Pet.PrimaryPart.Size.Y/2
end
local TargetCFrame = CFrame.new(HumanoidRootPart.CFrame.X, -0, HumanoidRootPart.CFrame.Z) * HumanoidRootPart.CFrame.Rotation * CFrame.new(X - XOffset, Y, Z)
Pet.PrimaryPart.CFrame = Pet.PrimaryPart.CFrame:Lerp(TargetCFrame, 0.1)
end