Hello All,
-
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. -
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 -
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!