Newly created Pet falls through floor but only after I jump, and can't figure out why?

Hello All,

  1. What do you want to achieve?
    I created a Pet System for my game. I’m using the normal Bunny, Dog, Bat, etc, pets. The Bunny and Dog work, but the Bat for some reason, it works fine, but when the player jumps, the Bat bounces and then falls through the floor. I’m trying to figure out why this is happening but can’t seem to find the cause.

  2. What is the issue?
    The issue is, from what I’ve observed, any Pet that is a bit larger than the usual ‘block’ pet, when a player jumps, it seems to bounce a bit and then eventually falls through the floor. I used an Alvin Blox 2-year-old tutorial as a guide, so I’m also wondering if perhaps the code it outdated? The video is this one:
    PET INVENTORY & EQUIPPING PETS! Roblox Egg Hatching System Tutorial Part 2 - YouTube

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I have mucked around with physical properties, and with collide properties, and also have looked at ways to alter the code.

-- This is the main function that creates the Pet and parents it

PetsManager.equipPet = function(player, pet)
	local character = player.Character

	if pet ~= nil and character ~= nil then
		-- if player had a PET, then destroy it to equip the new one
		if character:FindFirstChild("PET") then character.PET:Destroy() end
		if character.HumanoidRootPart:FindFirstChild("attachmentCharacter") then 
			character.HumanoidRootPart:FindFirstChild("attachmentCharacter"):Destroy() 		
		end
		
		pet:SetPrimaryPartCFrame(character.HumanoidRootPart.CFrame)

		local modelSize = pet.PrimaryPart.Size

		local attachmentCharacter = Instance.new("Attachment")
		attachmentCharacter.Name = "attachmentCharacter"
		attachmentCharacter.Visible = false
		attachmentCharacter.Parent = character.HumanoidRootPart
		attachmentCharacter.Position = Vector3.new(1,1,0) + modelSize
		
		-- puts attachment in Hitbox (primaryPart) of Pet Model
		local attachmentPet = Instance.new("Attachment")
		attachmentPet.Visible = false
		attachmentPet.Parent = pet.PrimaryPart

		local alignPosition = Instance.new("AlignPosition")
		alignPosition.MaxForce = 25000
		alignPosition.Attachment0 = attachmentPet
		alignPosition.Attachment1 = attachmentCharacter
		alignPosition.Responsiveness = 25
		alignPosition.Parent = pet

		local alignOrientation = Instance.new("AlignOrientation")
		alignOrientation.MaxTorque = 25000
		alignOrientation.Attachment0 = attachmentPet
		alignOrientation.Attachment1 = attachmentCharacter
		alignOrientation.Responsiveness = 25
		alignOrientation.Parent = pet
		
		pet.Name = "PET"
		pet.Parent = character
		
	end
end

As mentioned, what is weird is that it works perfectly fine as long as the player walks… but when the player jumps, that’s when the Bat bounces a few times and then falls through the floor.

Is there some type of configuration in regards to the MaxForce or MaxTorque that I’m missing?

Thanks for the help!

I found the solution and will put it here, in case someone encounters such an issue.

Basically, it was the MaxForce value of 25000 that I had. I saw this in in a devforum post:

MaxForce determines the power of the Velocity property . If the number is too low, the power is weak which would result in the part falling. If the number is too high, the power would maintain stable & allow the part to stay floating.

I messed around with the value I had and it ended up working pretty well at 37500. This solved my issue.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.