#help with pet equip/unequip system

1 messages · Page 1 of 1 (latest)

austere bramble
#
local petHide=game:GetService('ReplicatedStorage').petHide
local rs=game:GetService('RunService')
local hb=rs.Heartbeat
local basicPets={
    dog=game:GetService('ReplicatedStorage').dog,
    cat=game:GetService('ReplicatedStorage').cat
}

petEvent.OnServerEvent:Connect(function(player,petNameValue,equipCount)
    print(petNameValue)
    print(equipCount)
    local selectedPet=basicPets[petNameValue]
    local myPet=selectedPet:Clone()
    local char=player.Character
    local hmr=char:FindFirstChild('HumanoidRootPart')
    myPet.Parent=hmr
    local offset=equipCount
    
    petHide.OnServerEvent:Connect(function(player,equipCount)
        local newoffset=equipCount
        offset=newoffset
        print(offset)
    end)
    
    hb:Connect(function()
        print(offset)
        myPet.CFrame=hmr.CFrame*CFrame.new(0,0,5*offset)
    end)
end)```
how do i make it also remove the unequipped pets and not just change th offset? if i try doing that it just removes all of them, sorry if u have a hard time readin this script this is like my 5th attempt on this im trying to keep it as simple as possible aaaaa the inventory turnt out find but this is getting on my nervers i dont know what im doing
#

literally so broken i did better on my first attempt : (

upbeat tangle
#

for pethide

#

ngl