⁝ Context
I’m constructing my own Pet System where you’ll be able to crack open an egg and obtain a Common - Legendary Pet!
ㅤㅤㅤ
⁝ Problem
My pet floating system works well though not the collision. I’m using AlignPosition & AlignOrientation to do so. Though I can’t disable the collision of the pet or it will kick the player like a boot.
ㅤㅤㅤ
⁝ Script & Locations
Here’s my script:
function removeCurrentPet(Player) -- Arguement is the selected player
local PetList = game.ReplicatedStorage.Pets:GetChildren() -- List of all pets that exist
for _,pet in pairs(PetList) do -- Goes through the PetList
for index, part in pairs(Player.Character:GetChildren()) do -- Goes through players character
if part:IsA("Model") then if part.Name == pet.Name then part:Destroy() end end -- If it finds pet it destroys it
end
end
end
workspace.BluePart.ClickDetector.MouseClick:Connect(function(Player) -- When a clickdetector is pressed
removeCurrentPet(Player) -- Removes any existing pet
local char = Player.Character -- Gets character
local Pet = game.ReplicatedStorage.Pets.BlueBlock:Clone() -- Clones chosen pet
Pet.Parent = char -- Places pet in character
Pet:SetPrimaryPartCFrame(char.HumanoidRootPart.CFrame) -- Positions pet to the HumanoidRootPart
local PetAttachment = Pet.HitBox.PetAttachment -- Finds pet attachment (Attachment0)
local TorsoAttachment = Instance.new("Attachment") -- Creates torso attachment (Attachment1)
TorsoAttachment.Parent = char.HumanoidRootPart -- Places attachment in HumanoidRootPart
TorsoAttachment.Position = Vector3.new(2,4,2) -- Positions attachment
TorsoAttachment.Name = "TorsoAttachment" -- Names the attachment
local AlignPosition = Pet.HitBox.AlignPosition -- Finds AlignPosition of pet
AlignPosition.Attachment1 = TorsoAttachment -- Sets Attachment1 to TorsoAttachment
local AlignOrientation = Pet.HitBox.AlignOrientation -- Finds AlignOrientation of pet
AlignOrientation.Attachment1 = TorsoAttachment -- Sets Attachment1 to TorsoAttachment
end)
ㅤㅤ
The Script from above
ㅤㅤ
The Pet Locations
ㅤㅤ
The ClickDetector Locations
ㅤㅤㅤ
⁝ Thinkable Solutions
[•] To disable pet collision for every player through client-sided scripts.
[•] Find a better way to make a floating system.
[•] Use while loops for the same result. (Last Resort)
ㅤㅤ
Thank you for the assist!
ㅤㅤㅤ
⁝ Solution by @gertkeno
▣ Question: How do you fix this?
► Answer: By disabling massless, you are making it unable to use gravity!