So basically, I want to make a save data script for my pets system, but I don't know where to start, basically I'm following the alvinblox tutorial for pets (Don't bully me please lol) Here is my main script

local function equipPet (player,pet)
	local character = player.Character
	
	if pet ~= nil then
		if character:FindFirstChild(player.Name.."'s Pet") then character [player.Name.."'s Pet"]:Destroy() end
		if character.HumanoidRootPart:FindFirstChild("attachmentCharacter")then
		character.HumanoidRootPart:FindFirstChild("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.Visible = false
		attachmentCharacter.Parent = character.HumanoidRootPart
		attachmentCharacter.Position = Vector3.new(1,1,0) + modelSize
		attachmentCharacter.Name = "attachmentCharacter"
		
		pet.Parent = character
		
		local attachmentPet = Instance.new("Attachment")
		attachmentPet.Visible = false
		attachmentPet.Parent = pet.PrimaryPart
		pet.Parent = character
		
		local allignPosition = Instance.new("AlignPosition")
		allignPosition.MaxForce = 25000
		allignPosition.Attachment0 = attachmentPet
		allignPosition.Attachment1 = attachmentCharacter
		allignPosition.Responsiveness = 25
		
		allignPosition.Parent = pet
		
		local allignOrientation = Instance.new("AlignOrientation")
		allignOrientation.MaxTorque = 25000
		allignOrientation.Attachment0 = attachmentPet
		allignOrientation.Attachment1 = attachmentCharacter
		allignOrientation.Responsiveness = 25
		allignOrientation.Parent = pet
	end
end





game.Players.PlayerAdded:connect(function(player)
     local leaderstats = Instance.new("Model")
     leaderstats.Name = "leaderstats"
     leaderstats.Parent = player
	 
	local petInventory = Instance.new("Model")
     petInventory.Name = "petInventory"
	     petInventory.Parent = player
	
	local equippedPet = Instance.new("StringValue")
	equippedPet.Name = "equippedPet"
	equippedPet.Parent = petInventory
	
	player.CharacterAdded:Connect(function(char)
		if game.ReplicatedStorage:WaitForChild("Pets"):FindFirstChild(equippedPet.Value) then
			equipPet(player,game.ReplicatedStorage:WaitForChild("Pets"):FindFirstChild(equippedPet.Value):Clone())
		end
	end)
	
	equippedPet.Changed:Connect(function()
		if equippedPet ~= nil then
			if game.ReplicatedStorage:WaitForChild("Pets"):FindFirstChild(equippedPet.Value) then
				equipPet(player,game.ReplicatedStorage:WaitForChild("Pets"):FindFirstChild(equippedPet.Value):Clone())
			end
		end
	end)
 end)


game.ReplicatedStorage.EquipPet.OnServerEvent:Connect(function(player,petName)
	local pet = game.ReplicatedStorage.Pets:FindFirstChild(petName)
	
	if pet and player.petInventory:FindFirstChild(petName) then
		player.petInventory.equippedPet.Value = petName
	end
end)

game.ReplicatedStorage.UnequipPet.OnServerEvent:Connect(function(player)
	player.petInventory.equippedPet.Value = ""
	if player.Character:FindFirstChild(player.Name"'s Pet") then
		player.Character[player.Name.."'s Pet"]:Destroy()
	end
	
	if player.Character.HumanoidRootPart:FindFirstChild("attachmentCharacter") then
		player.Character.HumanoidRootPart:FindFirstChild("attachmentCharacter"):Destroy()
	end
end)

I can put any of the scripts that yall want in the comments if you need them