Scripting Help!

Hello! I am creating a pet system! This function is inside of a script in Server Script Service so when the pet is equipped this function will happen:

       
        local character = player.Character
       
        if pet ~= nil and character ~= nil then
               
                if character:FindFirstChild(player.Name.."'s Pet") then character[player.Name.."'s Pet"]:Destroy() end
                if character:FindFirstChild("attachmentCharacter") then
                         character("attachmentCharacter"):Destroy()
                end
               
                        pet.Name = player.Name.."'s Pet"
                       
                        pet:SetPrimaryPartCFrame(character.HumanoidRootPart.CFrame)
                       
                        local modelSize = pet.PrimaryPart.Size
                       
                        local attachmentCharacter = Instance.new("Attachment")
                        attachmentCharacter.Parent = character.HumanoidRootPart
                        attachmentCharacter.Name = "attachmentCharater"
                        attachmentCharacter.Visible = false
                        attachmentCharacter.Position = Vector3.new(0,-4,0) + modelSize
                       
                        local attachmentPet = Instance.new("Attachment")
                        attachmentPet.Parent = pet.PrimaryPart
                        attachmentPet.Visible = false
                       
                        local allignPosition = Instance.new("AlignPosition")
                        allignPosition.MaxForce = 25000
                        allignPosition.Attachment0 = attachmentPet
                        allignPosition.Attachment1 = attachmentCharacter
                        allignPosition.Responsiveness = 500
                        allignPosition.Parent = pet
                       
                        local allignOrientation = Instance.new("AlignOrientation")
                        allignOrientation.MaxTorque = 25000
                        allignOrientation.Attachment0 = attachmentPet
                        allignOrientation.Attachment1 = attachmentCharacter
                        allignOrientation.Responsiveness = 500
                        allignOrientation.Parent = pet
                       
                pet.Parent = character
 
                end
        end```

Instead of doing what I have done I would rather it be like a simulator where they move more freely! How would I do that?? Thanks!
1 Like

What issue are you experiencing, you did not explain yourself so well.

1 Like

Like some of the other replies mentioned, you’re not so clear with what you want, but if I’m understanding correctly, you want to weld a pet to the player’s character but also have the pet moving a bit so it looks more realistic.
If this is your issue, then I think that you can just animate the pets to move a bit. Please correct me if I’m not understanding correctly.

1 Like

OH OOPS! I missed it!! So basically i want it to be more like a simulator so its more smooth as less responsive!

1 Like